-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·63 lines (52 loc) · 1.62 KB
/
start.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
#!/bin/bash
mkdir -p .elixxir
mkdir -p blobs
mkdir -p results
if [[ $1 == "help" ]]; then
echo "usage: ./start.sh [testname]"
echo "Advanced runner for localenvironment and single integration tests,"
echo "this starts a network only if one is not running and has not output the"
echo "expected files. Accepts an optional test to run against the network."
echo "multiple distinct tests can in theory run in parallel, but this is not"
echo "well tested."
exit
fi
DEBUGLEVEL=${DEBUGLEVEL-1}
if [ -f results/network/serverpids ]
then
echo "SERVERS ALREADY UP..."
else
source network/network.sh results bin
fi
if [ -f results/ndf.json ]
then
echo "NDF FOUND..."
else
echo "DOWNLOADING TLS Cert..."
# -alpn h2 added to mimic grpc headers
CMD="openssl s_client -alpn h2 -showcerts -connect $(tr -d '[:space:]' < results/startgwserver.txt)"
echo $CMD
eval $CMD < /dev/null 2>&1 > "results/startgwcert.bin"
CMD="cat results/startgwcert.bin | openssl x509 -outform PEM"
echo $CMD
eval $CMD > "results/startgwcert.pem"
head "results/startgwcert.pem"
echo "DOWNLOADING NDF..."
CLIENTCMD="bin/client getndf --gwhost $(tr -d '[:space:]' < results/startgwserver.txt) --cert results/startgwcert.pem"
eval $CLIENTCMD >> results/ndf.json 2>&1 &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
cat results/ndf.json | jq . | head -5
file results/ndf.json
if [ ! -s results/ndf.json ]
then
echo "results/ndf.json is empty, cannot proceed"
exit -1
fi
fi
if [ ! -z $1 ]
then
TEST=$1
/bin/bash tests/$TEST/run.sh results/$TEST tests/$TEST/clients.goldoutput results/ndf.json || true
fi