From 4de88e51d5afe99cd71d85574c0d2352bcffe467 Mon Sep 17 00:00:00 2001
From: joshemb <josh@elixxir.io>
Date: Wed, 20 Jul 2022 11:02:38 -0700
Subject: [PATCH] Use ephemeral initialization flag for connection tests

---
 basice2e/-                                |  1 +
 basice2e/clients.goldoutput/client201.txt |  2 +
 basice2e/clients.goldoutput/client203.txt |  2 +
 basice2e/run.sh                           | 72 ++++++++++++++++++++---
 basice2e/tmp                              |  8 +++
 5 files changed, 77 insertions(+), 8 deletions(-)
 create mode 100644 basice2e/-
 create mode 100644 basice2e/tmp

diff --git a/basice2e/- b/basice2e/-
new file mode 100644
index 0000000..708356a
--- /dev/null
+++ b/basice2e/-
@@ -0,0 +1 @@
+<xxc(2)0Tn65dcaNnvkZNbGnn9EhuW3qD0D6sDnGgWGJoqxGtoDrgZ7Ugdw/BAr6cdsGnfdtW48mvt+1hEE+unorwuFjzHdCBpXqddAtM5fPczC3sEP8SNdtVxN3BZ3tTXntFTMgklZPEjIL0P5+GXsyPA2BwAbMHlG6/UQ69kdwC0s/qgz7bAcXxhilk/RnopTVYHAoyqSkm43EpJLbVRX6jg6JyDqg3M8QhEOGKbrBwfxmWFosroBP2gUWJAtR3vDHaVjLku4hbeVPHDIJJlCN94Y0YDjpRTg788ad6B3gSN759gPuvKK1mL+ilB6U7tl/XDvidTCjUUqbEZcLQIthfAHmMjyn6AKFTPPigqCkFHOJyYXvhbvZOri7cag8dSqCvXfvgoOnzXAyLf1Yvy7+5e4bqAwZGY3bGrLxPGTz1yxoKKH3+TRMXdXXGb0tRrnAePXbUwrn1i4lnmiUTdNioP2BswViBZZy246fqJpICWG8oEO6E+SS/qPL9rdux7Dxr88hgwndHoKNEW9Q6lPDx+TqV7/Pq8W6droEOmEhn11KfgWXNlZkBfP7QNMyhPcdfjDFYPA4Dqt5GuC8QAAAgA7f2vtFu2mhRGc1XtaLU/Z0g==xxc>
\ No newline at end of file
diff --git a/basice2e/clients.goldoutput/client201.txt b/basice2e/clients.goldoutput/client201.txt
index 6323b37..79da732 100644
--- a/basice2e/clients.goldoutput/client201.txt
+++ b/basice2e/clients.goldoutput/client201.txt
@@ -1,6 +1,8 @@
+Loading ephemerally
 Sending connection request
 Established connection with server
 Sent message "Hello 200 from 201, using connections" to connection partner.
+Loading ephemerally
 Sending connection request
 Established connection with server
 Disconnected from partner
diff --git a/basice2e/clients.goldoutput/client203.txt b/basice2e/clients.goldoutput/client203.txt
index 3d48339..6608551 100644
--- a/basice2e/clients.goldoutput/client203.txt
+++ b/basice2e/clients.goldoutput/client203.txt
@@ -1,6 +1,8 @@
+Loading ephemerally
 Sending connection request
 Established authenticated connection with server.
 Sent message "Hello 202 from 203, using connections" to connection partner.
+Loading ephemerally
 Sending connection request
 Established authenticated connection with server.
 Disconnected from partner
diff --git a/basice2e/run.sh b/basice2e/run.sh
index 696ab0a..54b89ba 100755
--- a/basice2e/run.sh
+++ b/basice2e/run.sh
@@ -1167,36 +1167,66 @@ echo "FILE TRANSFER FINISHED..."
 ###############################################################################
 
 echo "TESTING CONNECTIONS..."
+echo "Testing Ephemeral Initialization..."
 # Initiate server
-CLIENTCMD="timeout 240s ../bin/client connection -s blob200 $CONNECTIONOPTS --writeContact $CLIENTOUT/client200-server.bin -l $CLIENTOUT/client200.log --startServer --serverTimeout 2m"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -s blob200 $CONNECTIONOPTS --writeContact $CLIENTOUT/client200-server.bin -l $CLIENTOUT/client200.log --startServer --serverTimeout 2m"
 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"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -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"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -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"
+echo "Ephemeral Test Complete."
+
+
+# TODO: TEST NON-EPHEMERAL CODE-PATH WHEN SUPPORTED
+#echo "Testing Non-Ephemeral Initialization..."
+## Initiate server
+#CLIENTCMD="timeout 240s ../bin/client connection -s blob200 $CONNECTIONOPTS --writeContact $CLIENTOUT/client200-server.bin -l $CLIENTOUT/client200.log --startServer --serverTimeout 2m"
+#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 "Non-Ephemeral Test Complete."
+#
 
+echo "CONNECTION TESTS FINISHED"
 
 ###############################################################################
 # Test authenticated connections
 ###############################################################################
 echo "TESTING AUTHENTICATED CONNECTIONS..."
+echo "Testing Ephemeral Initialization..."
 # Initiate server
-CLIENTCMD="timeout 240s ../bin/client connection -s blob202 --authenticated $CONNECTIONOPTS --writeContact $CLIENTOUT/client202-server.bin -l $CLIENTOUT/client202.log --startServer --serverTimeout 2m"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -s blob202 --authenticated $CONNECTIONOPTS --writeContact $CLIENTOUT/client202-server.bin -l $CLIENTOUT/client202.log --startServer --serverTimeout 2m"
 eval $CLIENTCMD > $CLIENTOUT/client202.txt 2>&1 || true &
 PIDVAL1=$!
 echo "$CLIENTCMD -- $PIDVAL1"
@@ -1204,20 +1234,46 @@ 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"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -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"
+CLIENTCMD="timeout 240s ../bin/client connection --ephemeral -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 "Ephemeral test complete."
+
+# TODO: TEST NON-EPHEMERAL CODE-PATH WHEN SUPPORTED
+#echo "Testing Non-Ephemeral Initialization..."
+## Initiate server
+#CLIENTCMD="timeout 240s ../bin/client connection -s blob202 --authenticated $CONNECTIONOPTS --writeContact $CLIENTOUT/client202-server.bin -l $CLIENTOUT/client202.log --startServer --serverTimeout 2m"
+#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 "Non-Ephemeral Test Complete."
 
 echo "AUTHENTICATED CONNECTION TESTS FINISHED"
 
diff --git a/basice2e/tmp b/basice2e/tmp
new file mode 100644
index 0000000..c45f321
--- /dev/null
+++ b/basice2e/tmp
@@ -0,0 +1,8 @@
+Disconnected from partner
+Established 
+Established 
+loading ephemerally
+loading ephemerally
+Sending connection request
+Sending connection request
+Sent message "Hello 202 from 203, using connections" to connection partner.
-- 
GitLab