github.com/unigraph-dev/dgraph@v1.1.1-0.20200923154953-8b52b426f765/contrib/tlstest/test_reload.sh (about) 1 #!/bin/bash 2 3 trap "cleanup" EXIT 4 5 cleanup() { 6 killall -9 dgraph >/dev/null 2>/dev/null 7 } 8 9 ALPHA=./alpha_tls.sh 10 LIVE=./live_tls.sh 11 EXPECTED=1 12 13 $DGRAPH_BIN zero -w zw -o 1 > zero.log 2>&1 & 14 sleep 5 15 16 # start the server 17 $ALPHA > /dev/null 2>&1 & 18 timeout 30s $LIVE > /dev/null 2>&1 19 RESULT=$? 20 21 # regenerate TLS certificate 22 rm -f ./tls/ca.key 23 $DGRAPH_BIN cert -d $PWD/tls -n localhost -c live --force 24 pkill -HUP dgraph > /dev/null 2>&1 25 26 # try to connect again 27 timeout 30s $LIVE > /dev/null 2>&1 28 RESULT=$? 29 30 if [ $RESULT == $EXPECTED ]; then 31 exit 0 32 else 33 echo "Error while reloading TLS certificate" 34 exit 1 35 fi