forked from Hyperledger-TWGC/tape
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintegration-test.sh
executable file
·169 lines (153 loc) · 6.04 KB
/
integration-test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/env bash
set -ex
DIR=$PWD
docker build -t tape:latest .
network=fabric_test
export COMPOSE_PROJECT_NAME=fabric
CMD=run
case $1 in
1_4)
unset COMPOSE_PROJECT_NAME
# sadly, bootstrap.sh from release-1.4 still pulls binaries from Nexus, which is not available anymore
# Why comment following code? Please check this issue: https://github.com/Hyperledger-TWGC/tape/issues/159
# curl -vsS https://raw.githubusercontent.com/hyperledger/fabric/release-2.2/scripts/bootstrap.sh | bash
./test/bootstrap-v2.2.sh 1.4.12 1.5.2
cd ./fabric-samples/
git checkout release-1.4
cd ./first-network
echo y | ./byfn.sh up -i 1.4.12
## 1.4 cryptogen compensate
priv_sk=crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/*
cp -f $priv_sk crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/priv_sk
##
cp -r crypto-config "$DIR"
CONFIG_FILE=/config/test/config14org1andorg2.yaml
network=host
;;
2_2)
curl -sSL https://bit.ly/2ysbOFE | bash -s -- 2.2.2 1.4.9
cd ./fabric-samples/test-network
echo y | ./network.sh down -i 2.2
echo y | ./network.sh up createChannel -i 2.2
cp -r organizations "$DIR"
CONFIG_FILE=/config/test/config20org1andorg2.yaml
case $2 in
ORLogic)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-ccep "OR('Org1.member','Org2.member')")
;;
ENDORSEMNTONLY)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-ccep "OR('Org1.member','Org2.member')")
;;
COMMITONLY)
CONFIG_FILE=/config/test/config20selectendorser.yaml
ARGS=(-cci initLedger)
;;
*)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-cci initLedger)
;;
esac
echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}"
;;
2_5)
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
./install-fabric.sh docker samples binary
cd ./fabric-samples/test-network
echo y | ./network.sh down
echo y | ./network.sh up createChannel
cp -r organizations "$DIR"
CONFIG_FILE=/config/test/config20org1andorg2.yaml
case $2 in
ORLogic)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-ccep "OR('Org1.member','Org2.member')")
;;
ENDORSEMNTONLY)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-ccep "OR('Org1.member','Org2.member')")
;;
COMMITONLY)
CONFIG_FILE=/config/test/config20selectendorser.yaml
ARGS=(-cci initLedger)
;;
*)
CONFIG_FILE=/config/test/configlatest.yaml
ARGS=(-cci initLedger)
;;
esac
echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}"
;;
3_0)
curl -sSLO https://raw.githubusercontent.com/hyperledger/fabric/main/scripts/install-fabric.sh && chmod +x install-fabric.sh
./install-fabric.sh --fabric-version 3.0.0-rc1
cd fabric-samples/test-network
echo y | ./network.sh up createChannel -bft -c mychannel
ARGS=(-cci initLedger)
docker pull ghcr.io/hyperledger/fabric-baseos:2.5.0-alpha2
docker tag ghcr.io/hyperledger/fabric-baseos:2.5.0-alpha2 hyperledger/fabric-baseos:3.0
echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}"
cp -r organizations "$DIR"
CONFIG_FILE=/config/test/configlatest.yaml
;;
#latest)
# curl -vsS https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash
# cd ./fabric-samples/test-network
# echo y | ./network.sh down
# echo y | ./network.sh up createChannel
# cp -r organizations "$DIR"
#CONFIG_FILE=/config/test/configlatest.yaml
#ARGS=(-cci initLedger)
# case $2 in
# ORLogic)
# CONFIG_FILE=/config/test/configlatest.yaml
# ARGS=(-ccep "OR('Org1.member','Org2.member')")
# ;;
# ENDORSEMNTONLY)
# CONFIG_FILE=/config/test/configlatest.yaml
# ARGS=(-ccep "OR('Org1.member','Org2.member')")
# ;;
# COMMITONLY)
# CONFIG_FILE=/config/test/config20selectendorser.yaml
# ARGS=(-cci initLedger)
# ;;
# *)
# CONFIG_FILE=/config/test/configlatest.yaml
# ARGS=(-cci initLedger)
# ;;
# esac
# echo y | ./network.sh deployCC -ccn basic -ccp ../asset-transfer-basic/chaincode-go/ -ccl go "${ARGS[@]}"
# ;;
*)
echo "Usage: $1 [1_4|2_2|2_5|3_0]"
echo "When given version, start byfn or test network basing on specific version of docker image"
echo "For any value without mock, 1_4,2_2,2_5,3_0 will show this hint"
exit 0
;;
esac
cd "$DIR"
## warm up for the init chaincode block
sleep 10
case $2 in
ORLogic)
docker run -d --name tape3 -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape observer -c $CONFIG_FILE
docker run -d --name tape1 -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape traffic -c $CONFIG_FILE --rate=10 -n 500
docker run -d --name tape2 -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape traffic -c $CONFIG_FILE --rate=10 -n 500
sleep 10
timeout 10 docker logs tape3
timeout 10 docker logs tape2
;;
ENDORSEMNTONLY)
CMD=endorsementOnly
timeout 60 docker run --name tape -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape $CMD -c $CONFIG_FILE -n 500 --signers=10 --parallel=2
;;
COMMITONLY)
CMD=commitOnly
timeout 60 docker run --name tape -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape $CMD -c $CONFIG_FILE -n 500 --signers=10 --parallel=2
;;
*)
docker run --name tape -e TAPE_LOGLEVEL=debug --network $network -v $PWD:/config tape tape $CMD -c $CONFIG_FILE -n 500
;;
esac
docker logs peer0.org1.example.com