From 2704a9449cbe14b4f0bb36e0631c80f0cf0b9b0a Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 10:05:18 +0200 Subject: [PATCH 1/6] Acceptance: Reduce timings in discovery tests This PR reduces the timings in the `discovery_*_fetches_*` tests. This should make tests pass faster, and avoid revocations from being issued. --- acceptance/discovery_br_fetches_dynamic_acceptance/test | 8 ++++---- acceptance/discovery_br_fetches_static_acceptance/test | 7 ++++--- .../discovery_infra_fetches_dynamic_acceptance/test | 2 +- acceptance/discovery_infra_fetches_static_acceptance/test | 2 +- acceptance/discovery_util/util.sh | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/acceptance/discovery_br_fetches_dynamic_acceptance/test b/acceptance/discovery_br_fetches_dynamic_acceptance/test index dadee45d7b..f22ce505e8 100755 --- a/acceptance/discovery_br_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_br_fetches_dynamic_acceptance/test @@ -35,16 +35,16 @@ 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 + jq ".BeaconService[].Addrs.IPv4.Public.Addr = \"127.42.42.42\" | .Timestamp = $( date +%s) | .TTL = 2" $TOPO | sponge $DYNAMIC_FULL + sleep 0.5 check_connectivity_broken "invalid beacon service address" # Wait until dynamic topology expires. - sleep 10 + sleep 3 check_connectivity "dynamic topology expired" check_br_fail_action "dynamic" diff --git a/acceptance/discovery_br_fetches_static_acceptance/test b/acceptance/discovery_br_fetches_static_acceptance/test index a810a389ca..3b3adddac0 100755 --- a/acceptance/discovery_br_fetches_static_acceptance/test +++ b/acceptance/discovery_br_fetches_static_acceptance/test @@ -43,17 +43,18 @@ test_run() { # 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 + sleep 0.5 check_connectivity_broken "invalid beacon service address" # Check that the logs contain setting and writing the topo. + sleep 1 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. + # Set the valid static topology. cp $TOPO $STATIC_FULL - sleep 5 + sleep 0.5 check_connectivity "serve original static topology" check_br_fail_action "static" diff --git a/acceptance/discovery_infra_fetches_dynamic_acceptance/test b/acceptance/discovery_infra_fetches_dynamic_acceptance/test index 93f3e4e439..b618318a9b 100755 --- a/acceptance/discovery_infra_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_infra_fetches_dynamic_acceptance/test @@ -26,7 +26,7 @@ test_run() { # 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 cp $DYNAMIC_FULL $DYNAMIC_DEFAULT - sleep 6 + sleep 2 check_file "dynamic" check_logs "bs$IA_FILE-1" check_logs "cs$IA_FILE-1" diff --git a/acceptance/discovery_infra_fetches_static_acceptance/test b/acceptance/discovery_infra_fetches_static_acceptance/test index f7548fb555..c192958a0c 100755 --- a/acceptance/discovery_infra_fetches_static_acceptance/test +++ b/acceptance/discovery_infra_fetches_static_acceptance/test @@ -31,7 +31,7 @@ test_run() { # 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 cp $STATIC_FULL $STATIC_DEFAULT - sleep 6 + sleep 2 # Check that the mock ds serves the file check_file "static" # Check that the logs contain setting and writing the topo. diff --git a/acceptance/discovery_util/util.sh b/acceptance/discovery_util/util.sh index c616245afd..74754528a0 100644 --- a/acceptance/discovery_util/util.sh +++ b/acceptance/discovery_util/util.sh @@ -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() { From 7371dc90d08c8087663921a4982d37e163a91fc8 Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 10:10:13 +0200 Subject: [PATCH 2/6] parallelism --- .buildkite/acceptance-pipeline.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.buildkite/acceptance-pipeline.sh b/.buildkite/acceptance-pipeline.sh index 9d232fb56a..3e7c9586b8 100755 --- a/.buildkite/acceptance-pipeline.sh +++ b/.buildkite/acceptance-pipeline.sh @@ -16,7 +16,7 @@ fi host_acceptance="br_multi br_child br_parent br_peer br_core_multi br_core_childIf br_core_coreIf" -for test in ./acceptance/*_acceptance; do +for test in ./acceptance/discovery*_acceptance; do name="$(basename ${test%_acceptance})" if [[ ! "$name" =~ "$ACCEPTANCE_TEST" ]]; then continue @@ -43,6 +43,7 @@ for test in ./acceptance/*_acceptance; do echo " - $BASE/run_step run_acceptance $name" fi echo " timeout_in_minutes: 10" + echo " parallelism: 10" echo " retry:" echo " automatic:" echo " - exit_status: 5" # Pull failed From eaba8f98a022576a530eb6fd67b4c5e0668b6c9f Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 13:10:35 +0200 Subject: [PATCH 3/6] adapt timings --- .../test | 12 +++++++----- .../test | 18 ++++++++++-------- .../test | 8 ++++++-- .../test | 13 ++++++++----- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/acceptance/discovery_br_fetches_dynamic_acceptance/test b/acceptance/discovery_br_fetches_dynamic_acceptance/test index f22ce505e8..7ac2cae961 100755 --- a/acceptance/discovery_br_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_br_fetches_dynamic_acceptance/test @@ -38,15 +38,17 @@ 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 = 2" $TOPO | sponge $DYNAMIC_FULL - sleep 0.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 3 + 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" } diff --git a/acceptance/discovery_br_fetches_static_acceptance/test b/acceptance/discovery_br_fetches_static_acceptance/test index 3b3adddac0..2d5a6ab7fa 100755 --- a/acceptance/discovery_br_fetches_static_acceptance/test +++ b/acceptance/discovery_br_fetches_static_acceptance/test @@ -41,22 +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 0.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. - sleep 1 + 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 - # Set the valid static topology. + log "Setting original topology" cp $TOPO $STATIC_FULL - sleep 0.5 + + log "Waiting for revocation to expire." + sleep 12 check_connectivity "serve original static topology" + log "Checking fail action." check_br_fail_action "static" } diff --git a/acceptance/discovery_infra_fetches_dynamic_acceptance/test b/acceptance/discovery_infra_fetches_dynamic_acceptance/test index b618318a9b..db411eddda 100755 --- a/acceptance/discovery_infra_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_infra_fetches_dynamic_acceptance/test @@ -23,20 +23,24 @@ 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 = 1" $TOPO | sponge $DYNAMIC_FULL cp $DYNAMIC_FULL $DYNAMIC_DEFAULT sleep 2 check_file "dynamic" + 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" || \ diff --git a/acceptance/discovery_infra_fetches_static_acceptance/test b/acceptance/discovery_infra_fetches_static_acceptance/test index c192958a0c..88094d08e9 100755 --- a/acceptance/discovery_infra_fetches_static_acceptance/test +++ b/acceptance/discovery_infra_fetches_static_acceptance/test @@ -28,27 +28,29 @@ 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 2 - # Check that the mock ds serves the file check_file "static" - # Check that the logs contain setting and writing the topo. + 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" || \ @@ -56,6 +58,7 @@ check_logs() { } check_diff () { + log "Checking the stored static topology for $1." diff -q $STATIC_FULL gen-cache/$1-topo.json } From 05960884b74b361025ec48772c24b225536f4a78 Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 14:09:11 +0200 Subject: [PATCH 4/6] fix --- .buildkite/acceptance-pipeline.sh | 2 +- acceptance/discovery_infra_fetches_dynamic_acceptance/test | 5 +++-- acceptance/discovery_infra_fetches_static_acceptance/test | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.buildkite/acceptance-pipeline.sh b/.buildkite/acceptance-pipeline.sh index 3e7c9586b8..de0981b574 100755 --- a/.buildkite/acceptance-pipeline.sh +++ b/.buildkite/acceptance-pipeline.sh @@ -16,7 +16,7 @@ fi host_acceptance="br_multi br_child br_parent br_peer br_core_multi br_core_childIf br_core_coreIf" -for test in ./acceptance/discovery*_acceptance; do +for test in ./acceptance/discovery_infra*_acceptance; do name="$(basename ${test%_acceptance})" if [[ ! "$name" =~ "$ACCEPTANCE_TEST" ]]; then continue diff --git a/acceptance/discovery_infra_fetches_dynamic_acceptance/test b/acceptance/discovery_infra_fetches_dynamic_acceptance/test index db411eddda..e7992f6a7c 100755 --- a/acceptance/discovery_infra_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_infra_fetches_dynamic_acceptance/test @@ -25,11 +25,12 @@ test_run() { set -e 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 = 1" $TOPO | sponge $DYNAMIC_FULL + 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 2 + sleep 1 check_file "dynamic" + sleep 3 check_logs "bs$IA_FILE-1" check_logs "cs$IA_FILE-1" check_logs "ps$IA_FILE-1" diff --git a/acceptance/discovery_infra_fetches_static_acceptance/test b/acceptance/discovery_infra_fetches_static_acceptance/test index 88094d08e9..8c6c8f29e3 100755 --- a/acceptance/discovery_infra_fetches_static_acceptance/test +++ b/acceptance/discovery_infra_fetches_static_acceptance/test @@ -32,9 +32,10 @@ test_run() { 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 2 + sleep 1 check_file "static" + sleep 3 check_logs "bs$IA_FILE-1" check_logs "cs$IA_FILE-1" check_logs "ps$IA_FILE-1" From 26df875e4ccf97785d550c82b92c4c8eb70004e5 Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 15:20:05 +0200 Subject: [PATCH 5/6] TTL :shake_fist_at_uncaring_gods: --- acceptance/discovery_infra_fetches_dynamic_acceptance/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acceptance/discovery_infra_fetches_dynamic_acceptance/test b/acceptance/discovery_infra_fetches_dynamic_acceptance/test index e7992f6a7c..edaff7c7bb 100755 --- a/acceptance/discovery_infra_fetches_dynamic_acceptance/test +++ b/acceptance/discovery_infra_fetches_dynamic_acceptance/test @@ -30,7 +30,7 @@ test_run() { sleep 1 check_file "dynamic" - sleep 3 + sleep 7 check_logs "bs$IA_FILE-1" check_logs "cs$IA_FILE-1" check_logs "ps$IA_FILE-1" From ebb00b6e7e5e150027db2d6d3761449407c029bb Mon Sep 17 00:00:00 2001 From: roos Date: Thu, 5 Sep 2019 15:45:25 +0200 Subject: [PATCH 6/6] remove parallelism --- .buildkite/acceptance-pipeline.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/acceptance-pipeline.sh b/.buildkite/acceptance-pipeline.sh index de0981b574..9d232fb56a 100755 --- a/.buildkite/acceptance-pipeline.sh +++ b/.buildkite/acceptance-pipeline.sh @@ -16,7 +16,7 @@ fi host_acceptance="br_multi br_child br_parent br_peer br_core_multi br_core_childIf br_core_coreIf" -for test in ./acceptance/discovery_infra*_acceptance; do +for test in ./acceptance/*_acceptance; do name="$(basename ${test%_acceptance})" if [[ ! "$name" =~ "$ACCEPTANCE_TEST" ]]; then continue @@ -43,7 +43,6 @@ for test in ./acceptance/discovery_infra*_acceptance; do echo " - $BASE/run_step run_acceptance $name" fi echo " timeout_in_minutes: 10" - echo " parallelism: 10" echo " retry:" echo " automatic:" echo " - exit_status: 5" # Pull failed