Skip to content

Commit ba7c1cd

Browse files
committed
[FAB-1017] Fix due to code changes
This updates some files with more scaffolding and config changes for moving forward with the behave system and functional tests. There is also some cleanup to a feature file. Change-Id: I06705387bacb23772b4c25fde8dcca040cd1055d Signed-off-by: Latitia M Haskins <[email protected]>
1 parent e7d70a8 commit ba7c1cd

File tree

7 files changed

+109
-47
lines changed

7 files changed

+109
-47
lines changed

test/feature/configs/configtx.yaml

+54-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
---
22
################################################################################
33
#
4-
# Profile
4+
# Profiles
55
#
66
# - Different configuration profiles may be encoded here to be specified
7-
# as parameters to the configtxgen tool.
7+
# as parameters to the configtxgen tool. The profiles which specify consortiums
8+
# are to be used for generating the orderer genesis block. With the correct
9+
# consortium members defined in the orderer genesis block, channel creation
10+
# requests may be generated with only the org member names and a consortium name
811
#
912
################################################################################
1013
Profiles:
1114

1215
# SampleInsecureSolo defines a configuration which uses the Solo orderer,
1316
# contains no MSP definitions, and allows all transactions and channel
14-
# creation requests.
17+
# creation requests for the consortium SampleConsortium.
1518
SampleInsecureSolo:
1619
Orderer:
1720
<<: *OrdererDefaults
1821
Application:
1922
<<: *ApplicationDefaults
23+
Consortiums:
24+
SampleConsortium:
25+
Organizations:
2026

2127
# SampleInsecureKafka defines a configuration that differs from the
2228
# SampleInsecureSolo one only in that is uses the Kafka-based orderer.
@@ -26,9 +32,13 @@ Profiles:
2632
OrdererType: kafka
2733
Application:
2834
<<: *ApplicationDefaults
35+
Consortiums:
36+
SampleConsortium:
37+
Organizations:
2938

3039
# SampleSingleMSPSolo defines a configuration which uses the Solo orderer,
3140
# and contains a single MSP definition (the MSP sampleconfig).
41+
# The Consortium SampleConsortium has only a single member, SampleOrg
3242
SampleSingleMSPSolo:
3343
Orderer:
3444
<<: *OrdererDefaults
@@ -38,6 +48,26 @@ Profiles:
3848
<<: *ApplicationDefaults
3949
Organizations:
4050
- *SampleOrg
51+
Consortiums:
52+
SampleConsortium:
53+
Organizations:
54+
- *SampleOrg
55+
56+
# SampleEmptyInsecureChannel defines a channel with no members
57+
# and therefore no access control
58+
SampleEmptyInsecureChannel:
59+
Consortium: SampleConsortium
60+
Application:
61+
Organizations:
62+
63+
# SampleSingleMSPChannel defines a channel with only the sample org as a
64+
# member. It is designed to be used in conjunction with SampleSingleMSPSolo
65+
# and SampleSingleMSPKafka orderer profiles
66+
SampleSingleMSPChannel:
67+
Consortium: SampleConsortium
68+
Application:
69+
Organizations:
70+
- *SampleOrg
4171

4272
################################################################################
4373
#
@@ -60,27 +90,34 @@ Organizations:
6090
ID: DEFAULT
6191

6292
# MSPDir is the filesystem path which contains the MSP configuration.
63-
MSPDir: msp/sampleconfig
93+
MSPDir: msp
94+
95+
# AdminPrincipal dictates the type of principal used for an
96+
# organization's Admins policy. Today, only the values of Role.ADMIN and
97+
# Role.MEMBER are accepted, which indicates a principal of role type
98+
# ADMIN and role type MEMBER respectively.
99+
AdminPrincipal: Role.ADMIN
64100

65101
# BCCSP: Select which crypto implementation or library to use for the
66102
# blockchain crypto service provider.
67103
BCCSP:
68104
Default: SW
69105
SW:
70-
# TODO: The default Hash and Security level needs refactoring to be
71-
# fully configurable. Changing these defaults requires coordination
72-
# SHA2 is hardcoded in several places, not only BCCSP
106+
# TODO: The default Hash and Security level needs refactoring to
107+
# be fully configurable. Changing these defaults requires
108+
# coordination SHA2 is hardcoded in several places, not only
109+
# BCCSP.
73110
Hash: SHA2
74111
Security: 256
75-
# Location of key store. If this is unset, a location will
76-
# be chosen using: 'MSPDir'/keystore
112+
# Location of key store. If this is unset, a location will be
113+
# chosen using: 'MSPDir'/keystore
77114
FileKeyStore:
78115
KeyStore:
79116

80117
AnchorPeers:
81-
# AnchorPeers defines the location of peers which can be used
82-
# for cross org gossip communication. Note, this value is only
83-
# encoded in the genesis block in the Application section context.
118+
# AnchorPeers defines the location of peers which can be used for
119+
# cross-org gossip communication. Note, this value is only encoded
120+
# in the genesis block in the Application section context.
84121
- Host: 127.0.0.1
85122
Port: 7051
86123

@@ -112,7 +149,9 @@ Orderer: &OrdererDefaults
112149
MaxMessageCount: 10
113150

114151
# Absolute Max Bytes: The absolute maximum number of bytes allowed for
115-
# the serialized messages in a batch.
152+
# the serialized messages in a batch. If the "kafka" OrdererType is
153+
# selected, set 'message.max.bytes' and 'replica.fetch.max.bytes' on the
154+
# Kafka brokers to a value that is equal to or larger than this one.
116155
AbsoluteMaxBytes: 99 MB
117156

118157
# Preferred Max Bytes: The preferred maximum number of bytes allowed for
@@ -121,8 +160,8 @@ Orderer: &OrdererDefaults
121160
# bytes.
122161
PreferredMaxBytes: 512 KB
123162

124-
# Max Channels is the maximum number of channels to allow on the ordering network
125-
# When set to 0, this implies no maximum number of channels
163+
# Max Channels is the maximum number of channels to allow on the ordering
164+
# network. When set to 0, this implies no maximum number of channels.
126165
MaxChannels: 0
127166

128167
Kafka:

test/feature/peer.feature

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ Scenario Outline: FAB-3505: Test chaincode example02 deploy, invoke, and query
2222
When a user deploys chaincode at path "github.com/hyperledger/fabric/chaincode_example02" with ["init", "a", "1000" , "b", "2000"] with name "mycc"
2323
Then the chaincode is deployed
2424
When a user queries on the chaincode named "mycc" with args ["query", "a"]
25-
Then a user receives expected response is 1000
25+
Then a user receives expected response of 1000
2626
When a user invokes on the chaincode named "mycc" with args ["txId1", "invoke", "a", 10]
27-
When a user queries on the chaincode named "mycc" with args ["query", "a"]
28-
Then a user receives expected response is 990
27+
And a user queries on the chaincode named "mycc" with args ["query", "a"]
28+
Then a user receives expected response of 990
2929

30-
Given "Peer1" is taken down
30+
Given "peer1" is taken down
3131
When a user invokes on the chaincode named "mycc" with args ["txId1", "invoke", "a", 10]
3232
And I wait "15" seconds
33-
And "Peer1" comes back up
34-
When a user queries on the chaincode named "mycc" with args ["query", "a"] on "Peer1"
33+
And "peer1" comes back up
34+
When a user queries on the chaincode named "mycc" with args ["query", "a"] on "peer1"
3535
Then a user receives expected response is 980
3636
Examples:
3737
| type |

test/feature/steps/basic_impl.py

+26-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright IBM Corp. 2016 All Rights Reserved.
1+
# Copyright IBM Corp. 2017 All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -16,16 +16,38 @@
1616
from behave import *
1717
import time
1818

19+
20+
ORDERER_TYPES = ["solo",
21+
"kafka",
22+
"solo-msp"]
23+
24+
PROFILE_TYPES = {"solo": "SampleInsecureSolo",
25+
"kafka": "SampleInsecureKafka",
26+
"solo-msp": "SampleSingleMSPSolo"}
27+
28+
1929
@given(u'I wait "{seconds}" seconds')
2030
@when(u'I wait "{seconds}" seconds')
2131
@then(u'I wait "{seconds}" seconds')
2232
def step_impl(context, seconds):
2333
time.sleep(float(seconds))
2434

25-
@given(u'I have a bootstrapped fabric network of')
35+
@given(u'we compose "{composeYamlFile}"')
36+
def compose_impl(context, composeYamlFile):
37+
pass
38+
39+
@given(u'I have a bootstrapped fabric network')
2640
def step_impl(context):
2741
bootstrapped_impl(context, "solo")
2842

29-
@given(u'I have a bootstrapped fabric network of type {type}')
30-
def bootstrapped_impl(context, type):
43+
@given(u'I have a bootstrapped fabric network of type {networkType}')
44+
def bootstrapped_impl(context, networkType):
45+
pass
46+
47+
@given(u'{component} is taken down')
48+
def step_impl(context, component):
49+
pass
50+
51+
@given(u'{component} comes back up')
52+
def step_impl(context, component):
3153
pass

test/feature/steps/compose_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright IBM Corp. 2016 All Rights Reserved.
1+
# Copyright IBM Corp. 2017 All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

test/feature/steps/endorser_impl.py

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright IBM Corp. 2016 All Rights Reserved.
1+
# Copyright IBM Corp. 2017 All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -32,13 +32,21 @@ def step_impl(context):
3232
["init", "a", "100" , "b", "200"],
3333
"mycc")
3434

35-
@when(u'a user queries on the chaincode named {name}')
36-
def query_impl(context, name):
35+
@when(u'a user queries on the chaincode named {name} with args {args} on {component}')
36+
def query_impl(context, name, args, component):
3737
pass
3838

39+
@when(u'a user queries on the chaincode named {name} with args {args}')
40+
def step_impl(context, name, args):
41+
query_impl(context, name, json.loads(args), "peer0")
42+
43+
@when(u'a user queries on the chaincode named {name}')
44+
def step_impl(context, name):
45+
query_impl(context, name, ["query", "a"], "peer0")
46+
3947
@when(u'a user queries on the chaincode')
4048
def step_impl(context):
41-
query_impl(context, "mycc")
49+
query_impl(context, "mycc", ["query", "a"], "peer0")
4250

4351
@when(u'a user invokes {count} times on the chaincode named {name} with args {args}')
4452
def invokes_impl(context, count, name, args):
@@ -64,7 +72,10 @@ def step_impl(context):
6472
def step_impl(context):
6573
pass
6674

67-
@then(u'a user receives expected response')
68-
def step_impl(context):
75+
@then(u'a user receives expected response of {response}')
76+
def expected_impl(context, response):
6977
pass
7078

79+
@then(u'a user receives expected response')
80+
def step_impl(context):
81+
expected_impl(context, 1000)

test/feature/ft/steps/orderer_at_impl.py test/feature/steps/orderer_impl.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright IBM Corp. 2016 All Rights Reserved.
1+
# Copyright IBM Corp. 2017 All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -27,16 +27,6 @@
2727
"kafka": "SampleInsecureKafka",
2828
"solo-msp": "SampleSingleMSPSolo"}
2929

30-
@given(u'I wait "{seconds}" seconds')
31-
@when(u'I wait "{seconds}" seconds')
32-
@then(u'I wait "{seconds}" seconds')
33-
def step_impl(context, seconds):
34-
time.sleep(float(seconds))
35-
36-
37-
@given(u'we compose "{composeYamlFile}"')
38-
def step_impl(context, composeYamlFile):
39-
pass
4030

4131
@given(u'a bootstrapped orderer network of type {networkType}')
4232
def step_impl(context, networkType):

test/feature/ft/steps/orderer_util.py test/feature/steps/orderer_util.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright IBM Corp. 2016 All Rights Reserved.
1+
# Copyright IBM Corp. 2017 All Rights Reserved.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -18,11 +18,11 @@
1818
import datetime
1919

2020
try:
21-
pbFilePath = os.environ['GOPATH'] + "/src/github.com/hyperledger/fabric/bddtests"
21+
pbFilePath = "../../bddtests"
2222
sys.path.insert(0, pbFilePath)
2323
from common import common_pb2
2424
except:
25-
print "ERROR! Unable to import the protobuf libraries from the hyperledger/fabric/bddtests directory: {0}".format(sys.exc_info()[0])
25+
print("ERROR! Unable to import the protobuf libraries from the hyperledger/fabric/bddtests directory: {0}".format(sys.exc_info()[0]))
2626
sys.exit(1)
2727

2828

@@ -36,7 +36,7 @@ def _testAccessPBMethods():
3636
header = common_pb2.Header(channel_header=channel_header.SerializeToString(),
3737
signature_header=common_pb2.SignatureHeader().SerializeToString())
3838
payload = common_pb2.Payload(header=header,
39-
data="Functional test: {0}".format(datetime.datetime.utcnow()))
39+
data=str.encode("Functional test: {0}".format(datetime.datetime.utcnow())) )
4040
envelope = common_pb2.Envelope(payload=payload.SerializeToString())
4141
return envelope
4242

0 commit comments

Comments
 (0)