Skip to content

Commit

Permalink
FABN-1349 NodeSDK set init on lifecycle test
Browse files Browse the repository at this point in the history
Set the init required on the v2 chaincode lifecycle testing.

Signed-off-by: Bret Harrison <[email protected]>
Change-Id: I5cb272f085fd0ffe8ce212772e0c0548f44c5164
  • Loading branch information
harrisob committed Aug 15, 2019
1 parent 61064c6 commit 79b528a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
12 changes: 6 additions & 6 deletions test/scenario/features/chaincode_lifecycle.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ Feature: Use the v2.0 chaincode lifecycle process
Given I have created fabric-client network instances
Then I can create and join a version_two capabilities channel named tokenchannel to two organizations

And I can package node chaincode at version v1 named example_cc_node as organization org1 with goPath na located at ../../../../test/fixtures/chaincode/node_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package java chaincode at version v1 named example_cc_java as organization org1 with goPath na located at ../../../../test/fixtures/chaincode/java_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package golang chaincode at version v1 named example_cc_golang as organization org1 with goPath ../../../../test/fixtures/chaincode/goLang located at github.com/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package node chaincode at version v1 named example_cc_node as organization org1 with goPath na located at ../../../../test/fixtures/chaincode/node_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired
And I can package java chaincode at version v1 named example_cc_java as organization org1 with goPath na located at ../../../../test/fixtures/chaincode/java_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired
And I can package golang chaincode at version v1 named example_cc_golang as organization org1 with goPath ../../../../test/fixtures/chaincode/goLang located at github.com/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired

And I can install node chaincode at version v1 named example_cc_node as organization org1
And I can install java chaincode at version v1 named example_cc_java as organization org1
Expand All @@ -26,9 +26,9 @@ Feature: Use the v2.0 chaincode lifecycle process
And I can approve java chaincode at version v1 named example_cc_java as organization org1 on channel tokenchannel with endorsement policy both_orgs
And I can approve golang chaincode at version v1 named example_cc_golang as organization org1 on channel tokenchannel with endorsement policy both_orgs

And I can package node chaincode at version v1 named example_cc_node as organization org2 with goPath na located at ../../../../test/fixtures/chaincode/node_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package java chaincode at version v1 named example_cc_java as organization org2 with goPath na located at ../../../../test/fixtures/chaincode/java_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package golang chaincode at version v1 named example_cc_golang as organization org2 with goPath ../../../../test/fixtures/chaincode/goLang located at github.com/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata
And I can package node chaincode at version v1 named example_cc_node as organization org2 with goPath na located at ../../../../test/fixtures/chaincode/node_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired
And I can package java chaincode at version v1 named example_cc_java as organization org2 with goPath na located at ../../../../test/fixtures/chaincode/java_cc/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired
And I can package golang chaincode at version v1 named example_cc_golang as organization org2 with goPath ../../../../test/fixtures/chaincode/goLang located at github.com/example_cc and metadata located at ../../../../test/fixtures/chaincode/metadata with initrequired

And I can install node chaincode at version v1 named example_cc_node as organization org2
And I can install java chaincode at version v1 named example_cc_java as organization org2
Expand Down
11 changes: 8 additions & 3 deletions test/scenario/features/steps/chaincode_steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const Client = require('fabric-client');

module.exports = function () {

this.Then(/^I can package (.+?) chaincode at version (.+?) named (.+?) as organization (.+?) with goPath (.+?) located at (.+?) and metadata located at (.+?)$/,
this.Then(/^I can package (.+?) chaincode at version (.+?) named (.+?) as organization (.+?) with goPath (.+?) located at (.+?) and metadata located at (.+?) with (.+?)$/,
{timeout: testUtil.TIMEOUTS.SHORT_STEP},
async (chaincode_type, chaincode_version, chaincode_name, org_name, _go_path, _chaincode_path, metadata_path) => {
async (chaincode_type, chaincode_version, chaincode_name, org_name, _go_path, _chaincode_path, metadata_path, init_required) => {
const cc_save_name = format('chaincode-%s-%s', org_name, chaincode_name);

metadata_path = path.join(__dirname, metadata_path);
Expand All @@ -29,7 +29,12 @@ module.exports = function () {

const client = Client.getConfigSetting('client-' + org_name).value;
const chaincode = client.newChaincode(chaincode_name, chaincode_version);
// chaincode.setInitRequired(true);
if (init_required === 'initrequired') {
chaincode.setInitRequired(true);
testUtil.logMsg(` -- packaging step setting init required for ${chaincode_type} named ${chaincode_name}`);
} else {
testUtil.logMsg(` -- packaging step NO init required for ${chaincode_type} named ${chaincode_name}`);
}

const request = {
chaincodePath: chaincode_path,
Expand Down

0 comments on commit 79b528a

Please sign in to comment.