-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2eTest.sh
78 lines (68 loc) · 2.92 KB
/
e2eTest.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
if [ -d "${PWD}/configFiles" ]; then
KUBECONFIG_FOLDER=${PWD}/configFiles
else
echo "Configuration files are not found."
exit
fi
# Generate channel artifacts using configtx.yaml and then create channel
echo -e "\nCreating channel transaction artifact and a channel"
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/create_channel.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/create_channel.yaml
JOBSTATUS=$(kubectl get jobs -A|grep createchannel |awk '{print $3}')
while [ "${JOBSTATUS}" != "1/1" ]; do
echo "Waiting for createchannel job to be completed"
sleep 1;
if [ "$(kubectl get pods -n temp| grep createchannel | awk '{print $3}')" == "Error" ]; then
echo "Create Channel Failed"
exit 1
fi
JOBSTATUS=$(kubectl get jobs -A|grep createchannel |awk '{print $3}')
done
echo "Create Channel Completed Successfully"
# Join all peers on a channel
echo -e "\nCreating joinchannel job"
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/join_channel.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/join_channel.yaml
JOBSTATUS=$(kubectl get jobs -A|grep joinchannel |awk '{print $3}')
while [ "${JOBSTATUS}" != "1/1" ]; do
echo "Waiting for joinchannel job to be completed"
sleep 1;
if [ "$(kubectl get pods -n temp| grep joinchannel | awk '{print $3}')" == "Error" ]; then
echo "Join Channel Failed"
exit 1
fi
JOBSTATUS=$(kubectl get jobs -A|grep joinchannel |awk '{print $3}')
done
echo "Join Channel Completed Successfully"
# Install chaincode on each peer
echo -e "\nCreating installchaincode job"
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/chaincode_install.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/chaincode_install.yaml
JOBSTATUS=$(kubectl get jobs -A|grep chaincodeinstall |awk '{print $3}')
while [ "${JOBSTATUS}" != "1/1" ]; do
echo "Waiting for chaincodeinstall job to be completed"
sleep 1;
if [ "$(kubectl get pods -n temp| grep chaincodeinstall | awk '{print $3}')" == "Error" ]; then
echo "Chaincode Install Failed"
exit 1
fi
JOBSTATUS=$(kubectl get jobs -A|grep chaincodeinstall |awk '{print $3}')
done
echo "Chaincode Install Completed Successfully"
# Instantiate chaincode on channel
echo -e "\nCreating chaincodeinstantiate job"
echo "Running: kubectl create -f ${KUBECONFIG_FOLDER}/chaincode_instantiate.yaml"
kubectl create -f ${KUBECONFIG_FOLDER}/chaincode_instantiate.yaml
JOBSTATUS=$(kubectl get jobs -A|grep chaincodeinstantiate |awk '{print $3}')
while [ "${JOBSTATUS}" != "1/1" ]; do
echo "Waiting for chaincodeinstantiate job to be completed"
sleep 1;
if [ "$(kubectl get pods -n temp| grep chaincodeinstantiate | awk '{print $3}')" == "Error" ]; then
echo "Chaincode Instantiation Failed"
exit 1
fi
JOBSTATUS=$(kubectl get jobs -A|grep chaincodeinstantiate |awk '{print $3}')
done
echo "Chaincode Instantiation Completed Successfully"
sleep 15
echo -e "\ne2eTest Completed !!"