Skip to content

Commit

Permalink
[FAB-3628]: Add Crypto config
Browse files Browse the repository at this point in the history
This config file is used with cryptogen when generating
crypto material for use in the behave functional and
system tests.

Change-Id: I7800e21e6d0dbd892b8368e44c7c8be43ed3de3f
Signed-off-by: Latitia M Haskins <latitia.haskins@gmail.com>
  • Loading branch information
lhaskins committed May 3, 2017
1 parent 1dfdee5 commit 9970f15
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 9970f15

Please sign in to comment.