testing: slow down republisher sharness test
We'd frequently hit a race where we'd end up sleeping till *after* the record was republished. License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
Steven Allen committed
Dec 18, 2018 at 20:57 UTC
4743374f1427a27a95d756bb209c95a56affc65d
1 file changed
+11
-13
test/sharness/t0240-republisher.sh
+11
-13
@@ -21,7 +21,7 @@ setup_iptb() {
21
for i in $(test_seq 0 "$bound")
22
do
23
test_expect_success "set configs up for node $i" '
24
- ipfsi "$i" config Ipns.RepublishPeriod 20s &&
24
+ ipfsi "$i" config Ipns.RepublishPeriod 40s &&
25
ipfsi "$i" config --json Ipns.ResolveCacheSize 0
26
'
27
done
@@ -64,9 +64,7 @@ verify_cannot_resolve() {
64
for node in $(test_seq 0 "$bound")
65
do
66
test_expect_success "$msg: resolution fails on node $node" '
67
- # TODO: this should work without the timeout option
68
- # but it currently hangs for some reason every so often
69
- test_expect_code 1 ipfsi "$node" name resolve --timeout=300ms "$name"
67
+ test_expect_code 1 ipfsi "$node" name resolve "$name"
68
'
69
done
70
}
@@ -77,7 +75,7 @@ setup_iptb "$num_test_nodes"
75
76
test_expect_success "publish succeeds" '
77
HASH=$(echo "foobar" | ipfsi 1 add -q) &&
80
- ipfsi 1 name publish -t 5s $HASH
78
+ ipfsi 1 name publish -t 10s $HASH
79
'
80
81
test_expect_success "get id succeeds" '
@@ -86,13 +84,13 @@ test_expect_success "get id succeeds" '
84
85
verify_can_resolve "$num_test_nodes" "$id" "$HASH" "just after publishing"
86
89
-go-sleep 5s
87
+go-sleep 10s
88
91
-verify_cannot_resolve "$num_test_nodes" "$id" "after five seconds, records are invalid"
89
+verify_cannot_resolve "$num_test_nodes" "$id" "after 10 seconds, records are invalid"
90
93
-go-sleep 15s
91
+go-sleep 30s
92
95
-verify_can_resolve "$num_test_nodes" "$id" "$HASH" "republisher fires after twenty seconds"
93
+verify_can_resolve "$num_test_nodes" "$id" "$HASH" "republisher fires after 30 seconds"
94
95
#
96
@@ -102,16 +100,16 @@ KEY2=`ipfsi 1 key gen beepboop --type ed25519`
100
101
test_expect_success "publish with new key succeeds" '
102
HASH=$(echo "barfoo" | ipfsi 1 add -q) &&
105
- ipfsi 1 name publish -t 5s -k "$KEY2" $HASH
103
+ ipfsi 1 name publish -t 10s -k "$KEY2" $HASH
104
'
105
106
verify_can_resolve "$num_test_nodes" "$KEY2" "$HASH" "new key just after publishing"
107
110
-go-sleep 5s
108
+go-sleep 10s
109
112
-verify_cannot_resolve "$num_test_nodes" "$KEY2" "new key cannot resolve after 5 seconds"
110
+verify_cannot_resolve "$num_test_nodes" "$KEY2" "new key cannot resolve after 10 seconds"
111
114
-go-sleep 15s
112
+go-sleep 30s
113
114
verify_can_resolve "$num_test_nodes" "$KEY2" "$HASH" "new key can resolve again after republish"
115