From b80e5fe31a28a03fc003dcff4ea1d5326b4e57ff Mon Sep 17 00:00:00 2001 From: josh <josh@elixxir.io> Date: Wed, 29 Jun 2022 15:30:56 -0700 Subject: [PATCH] Add integration test for connections --- basice2e/clients.goldoutput/client200.txt | 3 ++ basice2e/clients.goldoutput/client201.txt | 7 +++ basice2e/clients.goldoutput/client202.txt | 6 +++ basice2e/clients.goldoutput/client203.txt | 7 +++ basice2e/run.sh | 63 ++++++++++++++++++++++- 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 basice2e/clients.goldoutput/client200.txt create mode 100644 basice2e/clients.goldoutput/client201.txt create mode 100644 basice2e/clients.goldoutput/client202.txt create mode 100644 basice2e/clients.goldoutput/client203.txt diff --git a/basice2e/clients.goldoutput/client200.txt b/basice2e/clients.goldoutput/client200.txt new file mode 100644 index 0000000..4e7afe2 --- /dev/null +++ b/basice2e/clients.goldoutput/client200.txt @@ -0,0 +1,3 @@ +Established connection server, begin listening... +Established connection with partner +Received message: Hello 200 from 201, using connections diff --git a/basice2e/clients.goldoutput/client201.txt b/basice2e/clients.goldoutput/client201.txt new file mode 100644 index 0000000..fc153c6 --- /dev/null +++ b/basice2e/clients.goldoutput/client201.txt @@ -0,0 +1,7 @@ +Sending connection request +Established connection with partner +Sent message "Hello 200 from 201, using connections" to connection partner. +Sending connection request +Established connection with partner +Disconnecting from connection partner +Disconnected from partner \ No newline at end of file diff --git a/basice2e/clients.goldoutput/client202.txt b/basice2e/clients.goldoutput/client202.txt new file mode 100644 index 0000000..e087fec --- /dev/null +++ b/basice2e/clients.goldoutput/client202.txt @@ -0,0 +1,6 @@ +Established connection server, begin listening for authentication... +Authenticated connection established +Received authenticated connection from client +Established connection with partner awaiting authentication... +Received message: Hello 202 from 203, using connections +Shutting down connection server diff --git a/basice2e/clients.goldoutput/client203.txt b/basice2e/clients.goldoutput/client203.txt new file mode 100644 index 0000000..b7294de --- /dev/null +++ b/basice2e/clients.goldoutput/client203.txt @@ -0,0 +1,7 @@ +Sending connection request +Established connection with partner. +Sent message "Hello 202 from 203, using connections" to connection partner. +Sending connection request +Established connection with partner. +Disconnecting from connection partner +Disconnected from partner diff --git a/basice2e/run.sh b/basice2e/run.sh index cb032d5..8ec7d6f 100755 --- a/basice2e/run.sh +++ b/basice2e/run.sh @@ -37,6 +37,7 @@ CLIENTGROUPOPTS="--password hello --waitTimeout 600 --ndf results/ndf.json -v $D CLIENTFILETRANSFEROPTS="--password hello --waitTimeout 600 --ndf results/ndf.json -v $DEBUGLEVEL" CLIENTREKEYOPTS="--password hello --ndf results/ndf.json --verify-sends --waitTimeout 420 --unsafe-channel-creation -v $DEBUGLEVEL" CLIENTBACKUPOPTS="--password hello --ndf results/ndf.json -v $DEBUGLEVEL" +CONNECTIONOPTS="--password hello --waitTimeout 90 --ndf results/ndf.json -v $DEBUGLEVEL" mkdir -p $SERVERLOGS mkdir -p $GATEWAYLOGS @@ -850,7 +851,7 @@ then eval $CLIENTCMD >> $CLIENTOUT/client31.txt || true & PIDVAL=$! echo "$CLIENTCMD -- $PIDVAL" - CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client13.log -s blob13 --destfile $CLIENTOUT/josh31.bin --sendCount 5 --receiveCount 5 -m \"Hello from Josh13, with E2E Encryption\"" + CLIENTCMD="timeout 240s ../bin/client $CLIENTOPTS -l $CLIENTOUT/client13.log -s blob13 --destfiledestfiledestfile $CLIENTOUT/josh31.bin --sendCount 5 --receiveCount 5 -m \"Hello from Josh13, with E2E Encryption\"" eval $CLIENTCMD >> $CLIENTOUT/client13.txt || true & PIDVAL2=$! echo "$CLIENTCMD -- $PIDVAL" @@ -1107,6 +1108,66 @@ wait $PIDVAL1 wait $PIDVAL2 echo "FILE TRANSFER FINISHED..." + + +############################################################################### +# Test connections +############################################################################### +echo "TESTING CONNECTIONS..." +# Initiate server +CLIENTCMD="timeout 240s ../bin/client connection -s blob200 $CONNECTIONOPTS --writeContact $CLIENTOUT/client200-server.bin -l $CLIENTOUT/client200.log --startServer --serverTimeout 1m15s" +eval $CLIENTCMD > $CLIENTOUT/client200.txt 2>&1 || true & +PIDVAL1=$! +echo "$CLIENTCMD -- $PIDVAL1" +echo "Sleeping to ensure connection server instantiation" +sleep 5 +# Initiate client and send message to server +CLIENTCMD="timeout 240s ../bin/client connection -s blob201 --connect $CLIENTOUT/client200-server.bin $CONNECTIONOPTS -l $CLIENTOUT/client201.log -m \"Hello 200 from 201, using connections\" --receiveCount 0" +eval $CLIENTCMD > $CLIENTOUT/client201.txt 2>&1 || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL2" +wait $PIDVAL2 + +# Disconnect +CLIENTCMD="timeout 240s ../bin/client connection -s blob201 $CONNECTIONOPTS -l $CLIENTOUT/client201.log --connect $CLIENTOUT/client200-server.bin --disconnect" +eval $CLIENTCMD >> $CLIENTOUT/client201.txt 2>&1 || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL2" +wait $PIDVAL2 +wait $PIDVAL1 +echo "CONNECTION TESTS FINISHED" + + +############################################################################### +# Test authenticated connections +############################################################################### +echo "TESTING AUTHENTICATED CONNECTIONS..." +# Initiate server +CLIENTCMD="timeout 240s ../bin/client connection -s blob202 --authenticated $CONNECTIONOPTS --writeContact $CLIENTOUT/client202-server.bin -l $CLIENTOUT/client202.log --startServer --serverTimeout 1m15s" +eval $CLIENTCMD > $CLIENTOUT/client202.txt 2>&1 || true & +PIDVAL1=$! +echo "$CLIENTCMD -- $PIDVAL1" +echo "Sleeping to ensure connection server instantiation" +sleep 5 + +# Initiate client and send message to server +CLIENTCMD="timeout 240s ../bin/client connection -s blob203 --authenticated --connect $CLIENTOUT/client202-server.bin $CONNECTIONOPTS -l $CLIENTOUT/client203.log -m \"Hello 202 from 203, using connections\" --receiveCount 0" +eval $CLIENTCMD > $CLIENTOUT/client203.txt 2>&1 || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL2" +wait $PIDVAL2 + +# Disconnect +CLIENTCMD="timeout 240s ../bin/client connection -s blob203 --authenticated $CONNECTIONOPTS -l $CLIENTOUT/client203.log --connect $CLIENTOUT/client202-server.bin --disconnect" +eval $CLIENTCMD >> $CLIENTOUT/client203.txt 2>&1 || true & +PIDVAL2=$! +echo "$CLIENTCMD -- $PIDVAL2" +wait $PIDVAL2 +wait $PIDVAL1 + + +echo "AUTHENTICATED CONNECTION TESTS FINISHED" + echo "TESTS EXITED SUCCESSFULLY, CHECKING OUTPUT..." -- GitLab