From 8f12583c8c262e8f48129b230212a4b3c7e0c4bc Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Sun, 9 May 2021 03:07:32 +0900 Subject: [PATCH] docker-tests: add test for server expiration cleanup --- docker-tests/run-docker-tests.sh | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/docker-tests/run-docker-tests.sh b/docker-tests/run-docker-tests.sh index dafdc72..4c2afa0 100755 --- a/docker-tests/run-docker-tests.sh +++ b/docker-tests/run-docker-tests.sh @@ -77,7 +77,7 @@ cmd docker exec "$PEER1_CONTAINER" innernet \ --admin false \ --auto-ip \ --save-config "/app/peer2.toml" \ - --invite-expires "30d" \ + --invite-expires "30s" \ --yes cmd docker cp "$PEER1_CONTAINER:/app/peer2.toml" "$tmp_dir" @@ -93,7 +93,35 @@ cmd docker cp "$tmp_dir/peer2.toml" "$PEER2_CONTAINER:/app/invite.toml" cmd docker start "$PEER2_CONTAINER" sleep 10 -# read -p "Press enter to continue. " -n 1 -r +info "Creating short-lived invitation for third peer." +cmd docker exec "$PEER1_CONTAINER" innernet \ + add-peer evilcorp \ + --name "peer3" \ + --cidr "robots" \ + --admin false \ + --ip "10.66.2.100" \ + --save-config "/app/peer3.toml" \ + --invite-expires "5s" \ + --yes + +info "waiting 15 seconds to see if the server clears out the IP address." +sleep 15 + +info "Re-requesting invite after expiration with the same parameters." +cmd docker exec "$PEER1_CONTAINER" innernet \ + add-peer evilcorp \ + --name "peer3" \ + --cidr "robots" \ + --admin false \ + --ip "10.66.2.100" \ + --save-config "/app/peer3_2.toml" \ + --invite-expires "30m" \ + --yes + +info "peer2 started as $PEER2_CONTAINER" +cmd docker cp "$tmp_dir/peer2.toml" "$PEER2_CONTAINER:/app/invite.toml" +cmd docker start "$PEER2_CONTAINER" +sleep 10 info "Checking connectivity betweeen peers." cmd docker exec "$PEER2_CONTAINER" ping -c3 10.66.0.1