Skip to content

Commit

Permalink
Directory restructure for Change 4383
Browse files Browse the repository at this point in the history
Somehow as part of cleanup for Change 4383, the
utility files that were moved from ./scripts to
./scripts/fvt are missing. Adding them back.

FAB-1892 Add functional tests for fabric-ca CI testing

Change-Id: I6e9fde41dec14fb43d3a3258013a553701097103
Signed-off-by: rennman <[email protected]>
  • Loading branch information
rennman committed Jan 30, 2017
1 parent 8ae8a5f commit d8d192e
Show file tree
Hide file tree
Showing 11 changed files with 1,640 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/fvt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Depending on the security settings and options requested, root authority may be

This is also true of the ``fabric-ca_setup.sh`` documented below.

Tests have been verified to run on Ubuntu linux.
Tests have been verified to run on Ubuntu 16.04.1 (Xenial).

### Prerequisites
* Go 1.6+ installation or later
Expand Down Expand Up @@ -44,4 +44,4 @@ To list all running instances of the server and the active database from the abo
To stop haproxy and all running instances of the server:
```
fabric-ca_setup.sh -R
```
```
69 changes: 69 additions & 0 deletions scripts/fvt/enroll.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
FABRIC_CA="$GOPATH/src/github.com/hyperledger/fabric-ca"
FABRIC_CAEXEC="$FABRIC_CA/bin/fabric-ca"
TESTDATA="$FABRIC_CA/testdata"
SCRIPTDIR="$FABRIC_CA/scripts/fvt"
. $SCRIPTDIR/fabric-ca_utils
HOST="http://localhost:8888"
RC=0

while getopts "du:p:t:l:x:" option; do
case "$option" in
d) FABRIC_CA_DEBUG="true" ;;
x) FABRIC_CA_HOME="$OPTARG" ;;
u) USERNAME="$OPTARG" ;;
p) USERPSWD="$OPTARG"
test -z "$USERPSWD" && AUTH=false
;;
t) KEYTYPE="$OPTARG" ;;
l) KEYLEN="$OPTARG" ;;
esac
done
test -z "$FABRIC_CA_HOME" && FABRIC_CA_HOME="$HOME/fabric-ca"
test -z "$CLIENTCERT" && CLIENTCERT="$FABRIC_CA_HOME/cert.pem"
test -z "$CLIENTKEY" && CLIENTKEY="$FABRIC_CA_HOME/key.pem"
test -f "$FABRIC_CA_HOME" || mkdir -p $FABRIC_CA_HOME

: ${FABRIC_CA_DEBUG="false"}
: ${AUTH="true"}
: ${USERNAME="admin"}
: ${USERPSWD="adminpw"}
$($AUTH) || unset USERPSWD
: ${KEYTYPE="ecdsa"}
: ${KEYLEN="256"}

test "$KEYTYPE" = "ecdsa" && sslcmd="ec"


genClientConfig "$FABRIC_CA_HOME/client-config.json"
$FABRIC_CAEXEC client enroll "$USERNAME" "$USERPSWD" "$HOST" <(echo "{
\"hosts\": [
\"[email protected]\",
\"fab-client.raleigh.ibm.com\",
\"127.0.0.2\"
],
\"CN\": \"$USERNAME\",
\"key\": {
\"algo\": \"$KEYTYPE\",
\"size\": $KEYLEN
},
\"names\": [
{
\"SerialNumber\": \"$USERNAME\",
\"O\": \"Hyperledger\",
\"O\": \"Fabric\",
\"OU\": \"FABRIC_CA\",
\"OU\": \"FVT\",
\"STREET\": \"Miami Blvd.\",
\"DC\": \"peer\",
\"UID\": \"admin\",
\"L\": \"Raleigh\",
\"L\": \"RTP\",
\"ST\": \"North Carolina\",
\"C\": \"US\"
}
]
}")
RC=$?
$($FABRIC_CA_DEBUG) && printAuth $CLIENTCERT $CLIENTKEY
exit $RC
Loading

0 comments on commit d8d192e

Please sign in to comment.