Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acceptance: Increase timings in discovery tests #3095

Merged
merged 6 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions acceptance/discovery_br_fetches_dynamic_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ test_setup() {

test_run() {
set -e
sleep 10
sleep 3
check_connectivity "initial check"

# Start serving dynamic topology with invalid beacon service.
jq ".BeaconService[].Addrs.IPv4.Public.Addr = \"127.42.42.42\" | .Timestamp = $( date +%s) | .TTL = 15" $TOPO | sponge $DYNAMIC_FULL
sleep 5
log "Staring to serve dynamic topology with wrong BS address."
jq ".BeaconService[].Addrs.IPv4.Public.Addr = \"127.42.42.42\" | .Timestamp = $( date +%s) | .TTL = 7" $TOPO | sponge $DYNAMIC_FULL
log "Waiting for BS to issue revocation and link going down"
sleep 4
check_connectivity_broken "invalid beacon service address"

# Wait until dynamic topology expires.
sleep 10
log "Waiting until dynamic topology expires and revocations are gone."
sleep 15
check_connectivity "dynamic topology expired"

log "Checking fail action."
check_br_fail_action "dynamic"
}

Expand Down
17 changes: 10 additions & 7 deletions acceptance/discovery_br_fetches_static_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,24 @@ test_run() {
sleep 3
check_connectivity "initial check"

# Start serving dynamic topology with invalid beacon service.
jq ".BeaconService[].Addrs.IPv4.Public.Addr = \"127.42.42.42\" | .Timestamp = $( date +%s) | .TTL = 15" $TOPO | sponge $STATIC_FULL
sleep 5
log "Staring to serve static topology with wrong BS address."
jq ".BeaconService[].Addrs.IPv4.Public.Addr = \"127.42.42.42\" | .Timestamp = $( date +%s)" $TOPO | sponge $STATIC_FULL
log "Waiting for BS to issue revocation and link going down"
sleep 4
check_connectivity_broken "invalid beacon service address"

# Check that the logs contain setting and writing the topo.
log "Checking topology is set and written to file system."
check_logs "br$IA_FILE-1"
# Check that the written file does not differ from the served file.
diff -q $STATIC_FULL logs/br$IA_FILE-1-topo.json

# Wait until dynamic topology expires.
log "Setting original topology"
cp $TOPO $STATIC_FULL
sleep 5

log "Waiting for revocation to expire."
sleep 12
check_connectivity "serve original static topology"

log "Checking fail action."
check_br_fail_action "static"
}

Expand Down
11 changes: 8 additions & 3 deletions acceptance/discovery_infra_fetches_dynamic_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@ test_setup() {

test_run() {
set -e
# Start serving dynamic topology. Full for infra services, default for sciond.
jq ".BorderRouters[].InternalAddrs.IPv4.PublicOverlay = {Addr: \"127.42.42.42\", OverlayPort: 39999} | .Timestamp = $( date +%s) | .TTL = 3" $TOPO | sponge $DYNAMIC_FULL

log "Starting to serve dynamic topology with modified border router."
jq ".BorderRouters[].InternalAddrs.IPv4.PublicOverlay = {Addr: \"127.42.42.42\", OverlayPort: 39999} | .Timestamp = $( date +%s) | .TTL = 5" $TOPO | sponge $DYNAMIC_FULL
cp $DYNAMIC_FULL $DYNAMIC_DEFAULT
sleep 6
sleep 1
check_file "dynamic"

sleep 7
check_logs "bs$IA_FILE-1"
check_logs "cs$IA_FILE-1"
check_logs "ps$IA_FILE-1"
check_logs "sd$IA_FILE"

log "Checking fail action."
check_infra_fail_action "dynamic"
}

check_logs() {
log "Checking logs for $1."
grep -q "\[discovery\] Set topology.*mode=dynamic" "logs/$1.log" || \
fail "Setting dynamic topology not found in logs. id=$1"
grep -q "\[itopo.cleaner\] Dropping expired dynamic topology" "logs/$1.log" || \
Expand Down
16 changes: 10 additions & 6 deletions acceptance/discovery_infra_fetches_static_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -28,34 +28,38 @@ test_setup() {

test_run() {
set -e
# Start serving static topology. Full for infra services, default for sciond.
jq ".BorderRouters[].InternalAddrs.IPv4.PublicOverlay = {Addr: \"127.42.42.42\", OverlayPort: 39999} | .Timestamp = $( date +%s) | .TTL = 3" $TOPO | sponge $STATIC_FULL

log "Starting to serve static topology with modified border router."
jq ".BorderRouters[].InternalAddrs.IPv4.PublicOverlay = {Addr: \"127.42.42.42\", OverlayPort: 39999} | .Timestamp = $( date +%s)" $TOPO | sponge $STATIC_FULL
cp $STATIC_FULL $STATIC_DEFAULT
sleep 6
# Check that the mock ds serves the file
sleep 1
check_file "static"
# Check that the logs contain setting and writing the topo.

sleep 3
check_logs "bs$IA_FILE-1"
check_logs "cs$IA_FILE-1"
check_logs "ps$IA_FILE-1"
check_logs "sd$IA_FILE"
# Check that the written file does not differ from the served file.

check_diff "bs$IA_FILE-1"
check_diff "cs$IA_FILE-1"
check_diff "ps$IA_FILE-1"
check_diff "sd$IA_FILE"

log "Checking fail action."
check_infra_fail_action "static"
}

check_logs() {
log "Checking logs for $1."
grep -q "\[discovery\] Set topology.*mode=static" "logs/$1.log" || \
fail "Setting static topology not found in logs. id=$1"
grep -q "\[discovery\] Topology written to filesystem.*mode=static" "logs/$1.log" || \
fail "Writing static topology not found in logs. id=$1"
}

check_diff () {
log "Checking the stored static topology for $1."
diff -q $STATIC_FULL gen-cache/$1-topo.json
}

Expand Down
2 changes: 1 addition & 1 deletion acceptance/discovery_util/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ set_log_lvl() {
}

set_interval() {
sed -i -e "/\[discovery.$2]/a Interval = \"1s\"" "$1"
sed -i -e "/\[discovery.$2]/a Interval = \"100ms\"" "$1"
}

set_connect() {
Expand Down