Skip to content
Snippets Groups Projects
Commit 65fa37f6 authored by Jonah Husson's avatar Jonah Husson
Browse files

Merge branch 'release' into feature/hotfix/channel-methods

parents 6474d409 c2374883
No related branches found
No related tags found
2 merge requests!68Master merge,!27Add broadcast testing
<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
# Client Session Tests: this script will run the "old" `client` binary to init session files and setup the environment
# for the "new" `client-release` binary to run tests on the old session files.
set -e
#set -o xtrace
# --- Define variables to use for the test & local network ---
DEBUGLEVEL=${DEBUGLEVEL-1}
CLIENTOPTS="--password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v $DEBUGLEVEL"
SERVERLOGS=results/servers
GATEWAYLOGS=results/gateways
UDBOUT=results/udb-console.txt
# --- Setup a local network ---
rm -rf client*.log blob* rick*.bin ben*.bin
rm -rf results.bak results
mkdir results
mkdir -p $SERVERLOGS
mkdir -p $GATEWAYLOGS
# Start the network
source network.sh
echo "DOWNLOADING TLS Cert..."
CMD="openssl s_client -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
# ------------------------------------------------------------------------------
# TESTS BEGIN BELOW
# ------------------------------------------------------------------------------
# --- Pre-canned messaging to self ---
timeout 240s ../bin/client --password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1 -l client9-master.log --sendCount 2 --receiveCount 2 -s blob9/blob9 --sendid 9 --destid 9 -m "Hi 9->9, with E2E Encryption"
timeout 240s ../bin/client-release --force-legacy --password hello --ndf results/ndf.json --sendDelay 100 --waitTimeout 360 --unsafe-channel-creation -v 1 -l client9-release.log --sendCount 2 --receiveCount 2 -s blob9/blob9 --sendid 9 --destid 9 -m "Hi 9->9, with E2E Encryption"
# --- Messaging to another use, E2E ---
# Init storage and request an E2E channel with each other
echo "SENDING E2E MESSAGES TO NEW USERS..."
CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-init.log -s blob42 --writeContact rick42-contact.bin --unsafe -m \"Hello from Rick42 to myself, without E2E Encryption\""
eval $CLIENTCMD || true &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client43-master-init.log -s blob43 --writeContact ben43-contact.bin --destfile rick42-contact.bin --send-auth-request --sendCount 0 --receiveCount 0"
eval $CLIENTCMD || true &
PIDVAL2=$!
echo "$CLIENTCMD -- $PIDVAL"
echo "Waiting for contact files to be created..."
while [ ! -s ben43-contact.bin ]; do
sleep 1
done
# Get the user's IDs
TMPID=$(cat client42-master-init.log | grep -a "User\:" | awk -F' ' '{print $5}')
RICKID=${TMPID}
echo "RICK ID: $RICKID"
TMPID=$(cat client43-master-init.log | grep -a "User\:" | awk -F' ' '{print $5}')
BENID=${TMPID}
echo "BEN ID: $BENID"
# Confirm channel with each other
CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-confirm.log -s blob42 --destfile ben43-contact.bin --sendCount 0 --receiveCount 0"
eval $CLIENTCMD || true &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
wait $PIDVAL2
# Send 5 messages to each other
CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client42-master-send.log -s blob42 --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\""
eval $CLIENTCMD || true &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
CLIENTCMD="timeout 360s ../bin/client $CLIENTOPTS -l client43-master-send.log -s blob43 --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\""
eval $CLIENTCMD || true &
PIDVAL2=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
wait $PIDVAL2
# Send 5 messages to each other with new client
CLIENTCMD="timeout 360s ../bin/client-release $CLIENTOPTS -l client42-release-send.log -s blob42 --force-legacy --destid b64:$BENID --sendCount 5 --receiveCount 5 -m \"Hello from Rick42, with E2E Encryption\""
eval $CLIENTCMD || true &
PIDVAL=$!
echo "$CLIENTCMD -- $PIDVAL"
CLIENTCMD="timeout 360s ../bin/client-release $CLIENTOPTS -l client43-release-send.log -s blob43 --force-legacy --destid b64:$RICKID --sendCount 5 --receiveCount 5 -m \"Hello from Ben43, with E2E Encryption\""
eval $CLIENTCMD || true &
PIDVAL2=$!
echo "$CLIENTCMD -- $PIDVAL"
wait $PIDVAL
wait $PIDVAL2
...@@ -19,6 +19,8 @@ Message received: Hello from Niamh101, with E2E Encryption ...@@ -19,6 +19,8 @@ Message received: Hello from Niamh101, with E2E Encryption
Message received: Hello from Niamh101, with E2E Encryption Message received: Hello from Niamh101, with E2E Encryption
Message received: Hello from Niamh101, with E2E Encryption Message received: Hello from Niamh101, with E2E Encryption
Message received: Hello from Niamh101, with E2E Encryption Message received: Hello from Niamh101, with E2E Encryption
Message received: type is KeyExchangeConfirm
Message received: type is KeyExchangeTrigger
Received 0 Received 0
Received 0 Received 0
Received 20 Received 20
......
...@@ -39,6 +39,8 @@ Message received: Hello from Jake100, with E2E Encryption ...@@ -39,6 +39,8 @@ Message received: Hello from Jake100, with E2E Encryption
Message received: Hello from Jake100, with E2E Encryption Message received: Hello from Jake100, with E2E Encryption
Message received: Hello from Jake100, with E2E Encryption Message received: Hello from Jake100, with E2E Encryption
Message received: Hello from Jake100, with E2E Encryption Message received: Hello from Jake100, with E2E Encryption
Message received: type is KeyExchangeConfirm
Message received: type is KeyExchangeTrigger
Received 0 Received 0
Received 20 Received 20
Received 20 Received 20
......
Established connection server, begin listening...
Established connection with client
ConnectionServer heard message "Hello 200 from 201, using connections"
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
Established connection server, begin listening...
Established authenticated connection with client
AuthServer heard message "Hello 202 from 203, using connections"
Established authenticated connection with client
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
Adding
Message received: Hello, 4 Message received: Hello, 4
Message received: Hello, 4 Message received: Hello, 4
Message received: Hello, 4 Message received: Hello, 4
...@@ -81,4 +80,3 @@ Sent: Hello, 5 ...@@ -81,4 +80,3 @@ Sent: Hello, 5
Sent: Hello, 5 Sent: Hello, 5
Sent: Hello, 5 Sent: Hello, 5
Sent: Hello, 5 Sent: Hello, 5
WARNING: unsafe channel creation enabled
# This script is used to start a basic 5 node network for running clients on. It is meant to be `source`'d into a script
# which will run clients on the network, such as `client-session-tests.sh` or the main `run.sh`.
#
# You **must** source it, because otherwise the `trap finish EXIT` instruction will cause the network to stop when
# network.sh returns to your script or shell. Sourcing it will "import" the commands into your script instead, causing
# the trap instruction to stop the network when your script/shell exits.
echo "STARTING SERVERS..."
# Copy udbContact into place when running locally.
cp udbContact.bin results/udbContact.bin
PERMCMD="../bin/permissioning --logLevel $DEBUGLEVEL -c permissioning.yaml "
$PERMCMD > results/permissioning-console.txt 2>&1 &
PIDVAL=$!
echo "$PERMCMD -- $PIDVAL"
# Run Client Registrar
CLIENT_REG_CMD="../bin/client-registrar \
-l 2 -c client-registrar.yaml"
$CLIENT_REG_CMD > results/client-registrat-console.txt 2>&1 &
PIDVAL=$!
echo "$CLIENT_REG_CMD -- $PIDVAL"
for SERVERID in $(seq 5 -1 1)
do
IDX=$(($SERVERID - 1))
SERVERCMD="../bin/server --logLevel $DEBUGLEVEL --config server-$SERVERID.yaml"
if [ $SERVERID -eq 5 ] && [ -n "$NSYSENABLED" ]
then
SERVERCMD="nsys profile --session-new=gputest --trace=cuda -o server-$SERVERID $SERVERCMD"
fi
$SERVERCMD > $SERVERLOGS/server-$SERVERID-console.txt 2>&1 &
PIDVAL=$!
echo "$SERVERCMD -- $PIDVAL"
done
# Start gateways
for GWID in $(seq 5 -1 1)
do
IDX=$(($GWID - 1))
GATEWAYCMD="../bin/gateway --logLevel $DEBUGLEVEL --config gateway-$GWID.yaml"
$GATEWAYCMD > $GATEWAYLOGS/gateway-$GWID-console.txt 2>&1 &
PIDVAL=$!
echo "$GATEWAYCMD -- $PIDVAL"
done
jobs -p > results/serverpids
finish() {
echo "STOPPING SERVERS AND GATEWAYS..."
if [ -n "$NSYSENABLED" ]
then
nsys stop --session=gputest
fi
# NOTE: jobs -p doesn't work in a signal handler
for job in $(cat results/serverpids)
do
echo "KILLING $job"
kill $job || true
done
sleep 5
for job in $(cat results/serverpids)
do
echo "KILL -9 $job"
kill -9 $job || true
done
#tail $SERVERLOGS/*
#tail $CLIENTCLEAN/*
#diff -aruN clients.goldoutput $CLIENTCLEAN
}
trap finish EXIT
trap finish INT
# Sleeps can die in a fire on the sun, we wait for the servers to start running
# rounds
rm rid.txt || true
touch rid.txt
cnt=0
echo -n "Waiting for a round to run"
while [ ! -s rid.txt ] && [ $cnt -lt 120 ]; do
sleep 1
grep -a "RID 1 ReceiveFinishRealtime END" results/servers/server-* > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
# Start a user discovery bot server
echo "STARTING UDB..."
UDBCMD="../bin/udb --logLevel $DEBUGLEVEL --skipVerification --protoUserPath udbProto.json --config udb.yaml -l 1"
$UDBCMD >> $UDBOUT 2>&1 &
PIDVAL=$!
echo $PIDVAL >> results/serverpids
echo "$UDBCMD -- $PIDVAL"
rm rid.txt || true
while [ ! -s rid.txt ] && [ $cnt -lt 30 ]; do
sleep 1
grep -a "Sending Poll message" results/udb-console.txt > rid.txt || true
cnt=$(($cnt + 1))
echo -n "."
done
echo "localhost:8440" > results/startgwserver.txt
echo "DONE LETS DO STUFF"
\ No newline at end of file
This diff is collapsed.
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.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment