-
Notifications
You must be signed in to change notification settings - Fork 0
/
testNetwork.sh
84 lines (68 loc) · 3.51 KB
/
testNetwork.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
#!/bin/bash
export PATH=${HOME}/fabric-samples/bin:$PATH
export BasicPATH=${HOME}/fabric-samples/test-network
export FABRIC_CFG_PATH=${HOME}/fabric-samples/config
export CORE_PEER_TLS_ENABLED=true
export CORE_PEER_LOCALMSPID="Org1MSP"
export CORE_PEER_TLS_ROOTCERT_FILE=${BasicPATH}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt
export CORE_PEER_MSPCONFIGPATH=${BasicPATH}/organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/msp
export CORE_PEER_ADDRESS=localhost:7051
ORDERER_CA=${BasicPATH}/organizations/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
PEER_CONN_PARMS="--peerAddresses localhost:7051 --tlsRootCertFiles ${BasicPATH}/organizations/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt --peerAddresses localhost:9051 --tlsRootCertFiles ${BasicPATH}/organizations/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
echo "TEST1 : Register"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"Register","Args":["yoochanong", "100", "1206"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt
sleep 3
echo "TEST2 : Register"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"Register","Args":["yoochanhong1", "50", "1207"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt
sleep 3
echo "TEST3 : QueryAllUser"
set -x
peer chaincode query -C mychannel -n fabcar -c '{"Args":["QueryAllUser"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt
echo "TEST4 : QueryUser"
set -x
peer chaincode query -C mychannel -n fabcar -c '{"Args":["QueryUser", "1206"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt
echo "TEST5 : MakeBank"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"MakeBank","Args":["1000"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt
sleep 3
echo "TEST6 : BorrowMoney"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"BorrowMoney","Args":["100", "1207"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txts
sleep 3
echo "TEST7 : BorrowMoney"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"BorrowMoney","Args":["100", "1207"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txts
sleep 3
echo "TEST8 : BorrowMoney"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"BorrowMoney","Args":["100", "1207"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txts
sleep 3
echo "TEST9 : TurnRoulette"
set -x
peer chaincode invoke -o localhost:7050 --ordererTLSHostnameOverride orderer.example.com --tls --cafile $ORDERER_CA -C mychannel -n fabcar $PEER_CONN_PARMS -c '{"function":"TurnRoulette","Args":["60", "1206"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txts
sleep 3
echo "TEST10 : QueryAllUser"
set -x
peer chaincode query -C mychannel -n fabcar -c '{"Args":["QueryAllUser"]}' >&log.txt
{ set +x; } 2>/dev/null
cat log.txt