1
1
#! /bin/bash
2
2
3
3
ROOTDIR=" $( cd " $( dirname " $0 " ) " /../../../.. && pwd) "
4
- FABRIC_V1_VERSION=1.4.11
5
- FABRIC_CA_V1_VERSION=1.4.9
6
- FABRIC_V2_VERSION=2.3.1
7
- FABRIC_CA_V2_VERSION=1.4.9
8
-
9
- echo " #### Downloaded fabric-test repo"
10
-
11
- if [ $# -eq 0 ]; then
12
- echo " $0 [-1 | -2]"
13
- exit 1;
14
- fi
15
-
16
- while getopts " 12" opt; do
17
- case " $opt " in
18
- 1)
19
- SDKVER=1.4.11
20
- export FABRIC_VERSION=1
21
- export RELEASE_VERSION=1.4-stable
22
- CHECKOUT_HASH=45799a2ee4eefa49ae705cc57ed415270c35d60a
23
- # export FABRIC_CFG_PATH=$GOPATH/src/github.com/hyperledger/fabric-test/scripts/config
24
- export PATH=$GOPATH /src/github.com/hyperledger/fabric-test/scripts/bin:$PATH
25
- PULL_PEER_IMAGE_VERSION=${FABRIC_V1_VERSION}
26
- PULL_CA_IMAGE_VERSION=${FABRIC_CA_V1_VERSION}
27
- ;;
28
- 2)
29
- SDKVER=2.0.0-beta.2
30
- export FABRIC_VERSION=2
31
- CHECKOUT_HASH=09680bea5aa0ec464982f7979fd99a777e8c1fed
32
- export FABRIC_CFG_PATH=$GOPATH /src/github.com/hyperledger/fabric-test/config
33
- export PATH=$GOPATH /src/github.com/hyperledger/fabric-test/bin:$PATH
34
- PULL_PEER_IMAGE_VERSION=${FABRIC_V2_VERSION}
35
- PULL_CA_IMAGE_VERSION=${FABRIC_CA_V2_VERSION}
36
- ;;
37
- * )
38
- echo " $0 [-1 | -2]"
39
- exit 1;
40
- ;;
41
- esac
42
- done
43
-
44
- echo " HASH: ${CHECKOUT_HASH} "
45
- echo " SDK : ${SDKVER} "
46
- echo " ROOT: ${ROOTDIR} "
47
4
48
- set -e
5
+ mkdir $ROOTDIR /test 2> /dev/null
49
6
50
- mkdir -p $GOPATH /src/github.com/hyperledger
51
-
52
- pushd $GOPATH /src/github.com/hyperledger
53
- sudo rm -rf fabric-test
54
- if [ ! -d fabric-test ]; then
55
- git clone https://github.com/hyperledger/fabric-test.git
56
- fi
57
- cd fabric-test
58
- # git checkout 45799a2ee4eefa49ae705cc57ed415270c35d60a
59
- git checkout ${CHECKOUT_HASH}
60
- make pull-binaries-fabric
61
- echo " #### Updated each sub-module under fabric-test repo"
62
- popd
7
+ pushd $ROOTDIR /test
63
8
64
- pushd $GOPATH /src/github.com/hyperledger/fabric-test/tools/PTE
65
- npm install fabric-client@${SDKVER}
66
- npm install fabric-ca-client@${SDKVER}
67
- echo " #### Installed required node packages"
68
- popd
9
+ curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.3.3 1.5.2
10
+ # curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.1.1 1.4.7 0.4.20
11
+ # curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.2.4 1.5.2
69
12
70
- pushd $ROOTDIR /app/platform/fabric/e2e-test
71
- rm -f PTE
72
- ln -s $GOPATH /src/github.com/hyperledger/fabric-test/tools/PTE ./PTE
73
13
popd
74
14
75
- pushd $ROOTDIR
76
- rm -rf wallet logs
77
- popd
15
+ pushd $ROOTDIR /test/fabric-samples/test-network
78
16
79
- curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s -- ${PULL_PEER_IMAGE_VERSION} ${PULL_CA_IMAGE_VERSION} 0.4.18 -s -b
80
- docker tag hyperledger/fabric-ca:${PULL_CA_IMAGE_VERSION} hyperledger/fabric-ca:${PULL_PEER_IMAGE_VERSION}
17
+ git checkout a97e8d1267fafb013aadae6850312c1b07a1ecd8
18
+ docker rm -f $( docker ps -qa) 2> /dev/null
19
+ docker volume rm $( docker volume ls -q) 2> /dev/null
20
+ ./network.sh down
81
21
82
- pushd $ROOTDIR /app/platform/fabric/e2e-test/specs
22
+ set -e
23
+
24
+ ./network.sh up createChannel -ca -c org1channel
25
+ ./network.sh createChannel -ca -c commonchannel
26
+ find organizations/peerOrganizations/ -type f -name " *_sk" | xargs dirname | xargs -I{} bash -c " pushd {} && ln -s *_sk priv_sk && popd"
27
+ ./network.sh deployCC -c org1channel -ccn basic -ccp ../asset-transfer-basic/chaincode-go -ccl go
28
+
29
+ export PATH=${PWD} /../bin:$PATH
30
+ export FABRIC_CFG_PATH=$PWD /../config/
31
+ export CORE_PEER_TLS_ENABLED=true
32
+ export CORE_PEER_LOCALMSPID=" Org1MSP"
33
+ export CORE_PEER_TLS_ROOTCERT_FILE=${PWD} /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
34
+ export CORE_PEER_MSPCONFIGPATH=
${PWD} /organizations/peerOrganizations/org1.example.com/users/
[email protected] /msp
35
+ export CORE_PEER_ADDRESS=localhost:7051
83
36
84
- rm -rf templates
85
- sed -i -e ' /github.com\/hyperledger\/fabric-test/d' go.mod
86
- if [ ${FABRIC_VERSION} -eq 2 ]; then
87
- cp -a templates-v2 templates
88
- go get github.com/hyperledger/fabric-test@${CHECKOUT_HASH}
89
- go get github.com/hyperledger/fabric-test/tools/operator@${CHECKOUT_HASH}
90
- go get github.com/hyperledger/fabric-test/chaincodes/samplecc/go@${CHECKOUT_HASH}
91
- else
92
- cp -a templates-v1 templates
93
- go get github.com/hyperledger/fabric-test@${CHECKOUT_HASH}
94
- fi
37
+ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile " ${PWD} /organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C org1channel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles " ${PWD} /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles " ${PWD} /organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c ' {"function":"InitLedger","Args":[]}'
38
+
39
+ sleep 3
40
+
41
+ peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile " ${PWD} /organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem" -C org1channel -n basic --peerAddresses localhost:7051 --tlsRootCertFiles " ${PWD} /organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt" --peerAddresses localhost:9051 --tlsRootCertFiles " ${PWD} /organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt" -c ' {"function":"TransferAsset","Args":["asset6","Christopher"]}'
42
+
43
+ popd
44
+
45
+ pushd $ROOTDIR /app/platform/fabric/e2e-test/specs
95
46
96
47
echo " #### Starting Ginkgo based test suite"
97
48
ginkgo -v -stream -failFast
49
+
98
50
popd
0 commit comments