Skip to content

Commit

Permalink
Merge "[FAB-3628]: Add Crypto config"
Browse files Browse the repository at this point in the history
  • Loading branch information
christo4ferris authored and Gerrit Code Review committed May 8, 2017
2 parents 70b59b0 + 9970f15 commit 14a3732
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
20 changes: 20 additions & 0 deletions test/feature/configs/crypto.yaml
@@ -0,0 +1,20 @@
OrdererOrgs:
- Name: Orderer
Domain: example.com
Specs:
- Hostname: orderer

PeerOrgs:
- Name: Org1
Domain: org1.example.com
Template:
Count: 2
Users:
Count: 1

- Name: Org2
Domain: org2.example.com
Template:
Count: 2
Users:
Count: 1
20 changes: 9 additions & 11 deletions test/feature/steps/config_util.py
@@ -1,4 +1,4 @@
# Copyright IBM Corp. 2016 All Rights Reserved.
# Copyright IBM Corp. 2017 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.
Expand All @@ -19,9 +19,9 @@
import sys
from shutil import copyfile

def generateConfig(context, channelID, profile, ordererBlock="orderer.block"):
def generateConfig(channelID, profile, projectName, ordererBlock="orderer.block"):
# Save all the files to a specific directory for the test
testConfigs = "configs/%s" % context.composition.projectName
testConfigs = "configs/%s" % projectName
if not os.path.isdir(testConfigs):
os.mkdir(testConfigs)

Expand All @@ -44,17 +44,15 @@ def generateConfig(context, channelID, profile, ordererBlock="orderer.block"):
print("Unable to generate channel config data: {0}".format(sys.exc_info()[0]))


def generateCrypto(context, numOrgs=2, numPeersPerOrg=2, numOrderers=1):
def generateCrypto(projectName):
# Save all the files to a specific directory for the test
testConfigs = "configs/%s" % context.composition.projectName
testConfigs = "configs/%s" % projectName
if not os.path.isdir(testConfigs):
os.mkdir(testConfigs)

try:
subprocess.check_call(["cryptogen",
"-peerOrgs", numOrgs,
"-ordererNodes", numOrderers,
"-peersPerOrg", numPeersPerOrg,
"-baseDir", testConfigs])
subprocess.check_call(["cryptogen", "generate",
'--output={0}'.format(testConfigs),
'--config=./configs/crypto.yaml'])
except:
print("Unable to generate crypto material: {0}".format(sys.exc_info()[0]))
print("Unable to generate crypto material: {0}".format(sys.exc_info()[1]))

0 comments on commit 14a3732

Please sign in to comment.