docker-tests: add test for server expiration cleanup

pull/72/head
Jake McGinty 2021-05-09 03:07:32 +09:00
parent fb1de8e210
commit 8f12583c8c
1 changed files with 30 additions and 2 deletions

View File

@ -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