Skip to content

Commit

Permalink
Reduce test sleep time (#2681)
Browse files Browse the repository at this point in the history
Since the BS pushes segments way faster since #2672 we don't need to sleep that much.
Also this PR includes a CryptoSyncer config (fixes #2674) so that we can reduce the sleep in topo_ps_reloads_cs acceptance test.
  • Loading branch information
lukedirtwalker authored May 14, 2019
1 parent ef24856 commit 8a8512e
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 54 deletions.
20 changes: 9 additions & 11 deletions acceptance/cert_renewal_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,20 @@ CORE_IA_FILE="$(ia_file $CORE_IA)"

test_setup() {
set -e
./scion.sh topology nobuild -c $TEST_TOPOLOGY -d -cs=go
for cfg in gen/ISD1/*/cs*/cs.toml; do
sed -i -e 's/Level = .*$/Level = "trace"/g' \
-e '/\[logging\.file\]/a FlushInterval = 1' \
-e '/\[cs\]/a AutomaticRenewal = true' \
-e "s/LeafReissueLeadTime.\+/LeafReissueLeadTime = \"$((363 * 24* 60 * 60 - 10))s\"/" \
-e "s/IssuerReissueLeadTime.\+/IssuerReissueLeadTime = \"$((364 * 24* 60 * 60 - 10))s\"/" \
-e 's/ReissueRate.\+/ReissueRate = "1s"/' \
-e 's/ReissueTimeout.\+/ReissueTimeout = "5s"/' "$cfg"
done
./scion.sh topology nobuild -c $TEST_TOPOLOGY -d -t
sed -i -e 's/Level = .*$/Level = "trace"/g' \
-e '/\[logging\.file\]/a FlushInterval = 1' \
-e '/\[cs\]/a AutomaticRenewal = true' \
-e "s/LeafReissueLeadTime.\+/LeafReissueLeadTime = \"$((363 * 24* 60 * 60 - 10))s\"/" \
-e "s/IssuerReissueLeadTime.\+/IssuerReissueLeadTime = \"$((364 * 24* 60 * 60 - 10))s\"/" \
-e 's/ReissueRate.\+/ReissueRate = "1s"/' \
-e 's/ReissueTimeout.\+/ReissueTimeout = "5s"/' gen/ISD1/*/cs*/cs.toml
./scion.sh run nobuild
}

test_run() {
set -e
sleep 10
sleep 5
bin/end2end_integration -src $IA -dst $CORE_IA -attempts 5 -d || fail "FAIL: Traffic does not pass."
# Make sure a reissue cycle has passed.
sleep 10
Expand Down
2 changes: 1 addition & 1 deletion acceptance/discovery_br_fetches_static_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_setup() {

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

# Start serving dynamic topology with invalid beacon service.
Expand Down
4 changes: 2 additions & 2 deletions acceptance/reconnecting_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TEST_TOPOLOGY="topology/Tiny.topo"

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
./scion.sh run nobuild
./tools/dc start tester_1-ff00_0_112 tester_1-ff00_0_110
docker_status
Expand All @@ -24,7 +24,7 @@ test_run() {
./tools/dc start scion_disp_1-ff00_0_112 scion_disp_1-ff00_0_110
./tools/dc scion restart scion_bs1-ff00_0_112-1 scion_bs1-ff00_0_110-1
sqlite3 gen-cache/sd1-ff00_0_112.path.db "delete from segments;"
sleep 10
sleep 5
bin/end2end_integration -src 1-ff00:0:112 -dst 1-ff00:0:110 -attempts 5 -d
}

Expand Down
2 changes: 1 addition & 1 deletion acceptance/sigutil/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test_setup() {
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d --sig -n 242.254.0.0/16
./scion.sh run nobuild
./tools/dc start 'tester*'
sleep 10
sleep 7
docker_status
}

Expand Down
4 changes: 1 addition & 3 deletions acceptance/topo_br_reload_util/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ base_setup() {

base_gen_topo() {
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d
for sd in gen/ISD1/*/br*/br.toml; do
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/br*/br.toml
}

base_run_topo() {
Expand Down
6 changes: 2 additions & 4 deletions acceptance/topo_invalid_reloads_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ TOPO="gen/ISD1/AS$AS_FILE/topology.json"

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/*/*.toml; do
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/*/*.toml
./tools/dc start scion_ps$IA_FILE-1 scion_sd$IA_FILE
docker_status
}
Expand Down
7 changes: 2 additions & 5 deletions acceptance/topo_ps_reloads_br_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ DST_IA=${DST_IA:-1-ff00:0:111}

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/ps*/ps.toml; do
sed -i 's/Level = .*$/Level = "trace"/g' "$sd"
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/ps*/ps.toml
./scion.sh run nobuild
./tools/dc start tester_$SRC_IA_FILE
docker_status
Expand Down
15 changes: 7 additions & 8 deletions acceptance/topo_ps_reloads_cs_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,23 @@ AS_FILE="$(as_file $IA)"

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/endhost/sd.toml; do
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i -e '/\[logging\.file\]/a FlushInterval = 1'\
-e '/\[ps\]/a\CryptoSyncInterval="1s"' gen/ISD1/*/ps*/ps.toml
./scion.sh run nobuild
docker_status
}

test_run() {
set -e
# Wait for the PS to be populated with crypto following beaconing
sleep 10
sleep 2
local topo_file="gen/ISD1/AS$AS_FILE/ps$IA_FILE-1/topology.json"
jq '.CertificateService[].Addrs.IPv4.Public = {Addr: "127.42.42.42", L4Port: 39999}' $topo_file | sponge $topo_file
./tools/dc scion kill -s HUP scion_ps$IA_FILE-1
# Wait for 30 (PS crypto push interval) + 1 (logging flush interval) + 30 (context timeout) + 1
# to guarantee a push is seen
sleep 62
# Wait for 1 (PS crypto push interval) + 1 (logging flush interval)
# + 1 to guarantee a push is seen
sleep 3
grep -q ".*$IA,\[127\.42\.42\.42\]:39999" "logs/ps$IA_FILE-1.log" || \
fail "CryptoSync log entry with 127.42.42.42:39999 not found in logs"
}
Expand Down
7 changes: 2 additions & 5 deletions acceptance/topo_sd_reloads_br_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ DST_IA=${DST_IA:-1-ff00:0:110}

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/endhost/sd.toml; do
sed -i 's/Level = .*$/Level = "trace"/g' "$sd"
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/endhost/sd.toml
./scion.sh run nobuild
./tools/dc start tester_$SRC_IA_FILE
docker_status
Expand Down
7 changes: 2 additions & 5 deletions acceptance/topo_sd_reloads_cs_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ DST_IA=${DST_IA:-1-ff00:0:110}

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/endhost/sd.toml; do
sed -i 's/Level = .*$/Level = "trace"/g' "$sd"
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/endhost/sd.toml
./scion.sh run nobuild
./tools/dc start tester_$SRC_IA_FILE
docker_status
Expand Down
7 changes: 2 additions & 5 deletions acceptance/topo_sd_reloads_ps_acceptance/test
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ DST_IA=${DST_IA:-1-ff00:0:110}

test_setup() {
set -e
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -sd=go -ps=go
for sd in gen/ISD1/*/endhost/sd.toml; do
sed -i 's/Level = .*$/Level = "trace"/g' "$sd"
sed -i '/\[logging\.file\]/a FlushInterval = 1' "$sd"
done
./scion.sh topology nobuild zkclean -c $TEST_TOPOLOGY -d -t
sed -i '/\[logging\.file\]/a FlushInterval = 1' gen/ISD1/*/endhost/sd.toml
./scion.sh run nobuild
./tools/dc start tester_$SRC_IA_FILE
docker_status
Expand Down
9 changes: 8 additions & 1 deletion go/path_srv/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ import (
)

var (
DefaultQueryInterval = 5 * time.Minute
DefaultQueryInterval = 5 * time.Minute
DefaultCryptoSyncInterval = 30 * time.Second
)

var _ config.Config = (*Config)(nil)
Expand Down Expand Up @@ -93,12 +94,18 @@ type PSConfig struct {
// QueryInterval specifies after how much time segments
// for a destination should be refetched.
QueryInterval util.DurWrap
// CryptoSyncInterval specifies the interval of crypto pushes towards
// the local CS.
CryptoSyncInterval util.DurWrap
}

func (cfg *PSConfig) InitDefaults() {
if cfg.QueryInterval.Duration == 0 {
cfg.QueryInterval.Duration = DefaultQueryInterval
}
if cfg.CryptoSyncInterval.Duration == 0 {
cfg.CryptoSyncInterval.Duration = DefaultCryptoSyncInterval
}
config.InitAll(&cfg.PathDB, &cfg.RevCache)
}

Expand Down
2 changes: 2 additions & 0 deletions go/path_srv/internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ func CheckTestPSConfig(cfg *PSConfig, id string) {
pathstoragetest.CheckTestRevCacheConf(&cfg.RevCache)
SoMsg("SegSync set", cfg.SegSync, ShouldBeFalse)
SoMsg("QueryInterval correct", cfg.QueryInterval.Duration, ShouldEqual, DefaultQueryInterval)
SoMsg("CryptoSyncInterval correct", cfg.CryptoSyncInterval.Duration,
ShouldEqual, DefaultCryptoSyncInterval)
}
3 changes: 3 additions & 0 deletions go/path_srv/internal/config/sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ SegSync = false
# The time after which segments for a destination are refetched. (default 5m)
QueryInterval = "5m"
# The interval of crypto pushes towards the local CS. (default 30s)
CryptoSyncInterval = "30s"
`
2 changes: 1 addition & 1 deletion go/path_srv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (t *periodicTasks) Start() {
DB: t.trustDB,
Msger: t.msger,
IA: t.args.IA,
}, periodic.NewTicker(30*time.Second), 30*time.Second)
}, periodic.NewTicker(cfg.PS.CryptoSyncInterval.Duration), cfg.PS.CryptoSyncInterval.Duration)
t.rcCleaner = periodic.StartPeriodicTask(revcache.NewCleaner(t.args.RevCache),
periodic.NewTicker(10*time.Second), 10*time.Second)
t.running = true
Expand Down
2 changes: 1 addition & 1 deletion integration/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ if is_docker_be; then
./tools/quiet ./tools/dc start "tester*"
fi

sleep 10
sleep 5
result=0

# Run go integration tests
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/integration
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if [ -n "$DOCKER_BE" ]; then
./docker.sh exec "set -eo pipefail; ./tools/dc start tester* |& tee -a logs/integration.run"
fi

sleep 20
sleep 5

COMMAND="$1"
shift
Expand Down

0 comments on commit 8a8512e

Please sign in to comment.