-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the scaffolding for building behave tests around endorsers and peers in general. Change-Id: Ic033fcc9389508b69be20747dbe5be60003b65ba Signed-off-by: Latitia M Haskins <[email protected]>
- Loading branch information
Showing
4 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Feature: Endorser Peer | ||
As a user I want to run and validate an endorsing peer | ||
|
||
Scenario Outline: Test basic chaincode deploy | ||
Given I have a bootstrapped fabric network of type <type> | ||
When a user deploys chaincode | ||
Then the chaincode is deployed | ||
When a user queries on the chaincode | ||
Then a user receives expected response | ||
Examples: | ||
| type | | ||
| solo | | ||
| kafka | |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Copyright IBM Corp. 2016 All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from behave import * | ||
import time | ||
|
||
@given(u'I wait "{seconds}" seconds') | ||
@when(u'I wait "{seconds}" seconds') | ||
@then(u'I wait "{seconds}" seconds') | ||
def step_impl(context, seconds): | ||
time.sleep(float(seconds)) | ||
|
||
@given(u'I have a bootstrapped fabric network of') | ||
def step_impl(context): | ||
bootstrapped_impl(context, "solo") | ||
|
||
@given(u'I have a bootstrapped fabric network of type {type}') | ||
def bootstrapped_impl(context, type): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright IBM Corp. 2016 All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from behave import * | ||
import json | ||
|
||
|
||
@when(u'a user deploys chaincode at path {path} with {args} with name {name}') | ||
def deploy_impl(context, path, args, name): | ||
pass | ||
|
||
@when(u'a user deploys chaincode at path {path} with {args}') | ||
def step_impl(context, path, args): | ||
deploy_impl(context, path, json.loads(args), "mycc") | ||
|
||
@when(u'a user deploys chaincode') | ||
def step_impl(context): | ||
deploy_impl(context, | ||
"github.com/hyperledger/fabric//chaincode_example02", | ||
["init", "a", "100" , "b", "200"], | ||
"mycc") | ||
|
||
@when(u'a user queries on the chaincode named {name}') | ||
def query_impl(context, name): | ||
pass | ||
|
||
@when(u'a user queries on the chaincode') | ||
def step_impl(context): | ||
query_impl(context, "mycc") | ||
|
||
@when(u'a user invokes {count} times on the chaincode named {name} with args {args}') | ||
def invokes_impl(context, count, name, args): | ||
pass | ||
|
||
@when(u'a user invokes on the chaincode named {name} with args {args}') | ||
def step_impl(context, name, args): | ||
invokes_impl(context, 1, name, json.loads(args)) | ||
|
||
@when(u'a user invokes {count} times on the chaincode') | ||
def step_impl(context, count): | ||
invokes_impl(context, count, "mycc", ["txId1", "invoke", "a", 5]) | ||
|
||
@when(u'a user invokes on the chaincode named {name}') | ||
def step_impl(context, name): | ||
invokes_impl(context, 1, name, ["txId1", "invoke", "a", 5]) | ||
|
||
@when(u'a user invokes on the chaincode') | ||
def step_impl(context): | ||
invokes_impl(context, 1, "mycc", ["txId1", "invoke", "a", 5]) | ||
|
||
@then(u'the chaincode is deployed') | ||
def step_impl(context): | ||
pass | ||
|
||
@then(u'a user receives expected response') | ||
def step_impl(context): | ||
pass | ||
|