Skip to contentSkip to conversation

tests: shell: fix spurious errors in sets/0036add_set_element_expiration_0

PATCH In review Pablo Neira Ayuso 3 participants 6 messages Sep 27, 2023 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 tests: shell: fix spurious errors in sets/0036add_set_element_expiration_0

Add seconds as expiration, otherwise 14m59 reports 14m in minute granularity, this ensures suficient time in a very slow environment with debugging instrumentation.

Fixes adf38fd84257 ("tests: shell: use minutes granularity in sets/0036add_set_element_expiration_0")

---
I still see this failing occasionally due to timing issues, fix it.

 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
index 12f10074409f..a50ac91d43a6 100755
@@ -8,7 +8,7 @@ drop_seconds() {
 
 RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
-add element ip x y { 1.1.1.1 timeout 30m expires 15m }"
+add element ip x y { 1.1.1.1 timeout 30m expires 15m59s }"
 
 test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation' | drop_seconds)
 
Signature · 1 line
2.30.2
reviewer
#1 lore raw
Quoted 17 lines · Pablo Neira Ayuso

Add seconds as expiration, otherwise 14m59 reports 14m in minute granularity, this ensures suficient time in a very slow environment with debugging instrumentation.

Fixes adf38fd84257 ("tests: shell: use minutes granularity in sets/0036add_set_element_expiration_0")

---
I still see this failing occasionally due to timing issues, fix it.

 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +0 -0
index 12f10074409f..a50ac91d43a6 100755

tests/shell/testcases/sets/0036add_set_element_expiration_0 drop_seconds() { · line 13

Quoted 7 lines
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
@@ -8,7 +8,7 @@ drop_seconds() {
 
 RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
-add element ip x y { 1.1.1.1 timeout 30m expires 15m }"
+add element ip x y { 1.1.1.1 timeout 30m expires 15m59s }"
 
 test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation' | drop_seconds)

The next line in that file is:

| if [ "$test_output" != "$RULESET" ] ; then

You add "59s" to $RULESET and drop it from $test_output. I guess, to make it work, you also need to pipe $RULESET through drop_seconds before the comparison.

Cheers, Phil

author maintainer
#2 lore raw
Quoted 28 lines · Phil Sutter
Quoted 17 lines · Pablo Neira Ayuso

Add seconds as expiration, otherwise 14m59 reports 14m in minute granularity, this ensures suficient time in a very slow environment with debugging instrumentation.

Fixes adf38fd84257 ("tests: shell: use minutes granularity in sets/0036add_set_element_expiration_0")

---
I still see this failing occasionally due to timing issues, fix it.

 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +0 -0
index 12f10074409f..a50ac91d43a6 100755

tests/shell/testcases/sets/0036add_set_element_expiration_0 drop_seconds() { · line 13

Quoted 7 lines
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
@@ -8,7 +8,7 @@ drop_seconds() {
 
 RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
-add element ip x y { 1.1.1.1 timeout 30m expires 15m }"
+add element ip x y { 1.1.1.1 timeout 30m expires 15m59s }"
 
 test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation' | drop_seconds)

The next line in that file is:

Quoted 5 lines

| if [ "$test_output" != "$RULESET" ] ; then

You add "59s" to $RULESET and drop it from $test_output. I guess, to make it work, you also need to pipe $RULESET through drop_seconds before the comparison.

Indeed, apologies: See latest patch.

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

author maintainer
#3 lore raw
Quoted 31 lines · Pablo Neira Ayuso
Quoted 30 lines · Phil Sutter
Quoted 17 lines · Pablo Neira Ayuso

Add seconds as expiration, otherwise 14m59 reports 14m in minute granularity, this ensures suficient time in a very slow environment with debugging instrumentation.

Fixes adf38fd84257 ("tests: shell: use minutes granularity in sets/0036add_set_element_expiration_0")

---
I still see this failing occasionally due to timing issues, fix it.

 tests/shell/testcases/sets/0036add_set_element_expiration_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/0036add_set_element_expiration_0 +0 -0
index 12f10074409f..a50ac91d43a6 100755

tests/shell/testcases/sets/0036add_set_element_expiration_0 drop_seconds() { · line 13

Quoted 7 lines
tests/shell/testcases/sets/0036add_set_element_expiration_0 +1 -1
@@ -8,7 +8,7 @@ drop_seconds() {
 
 RULESET="add table ip x
 add set ip x y { type ipv4_addr; flags dynamic,timeout; } 
-add element ip x y { 1.1.1.1 timeout 30m expires 15m }"
+add element ip x y { 1.1.1.1 timeout 30m expires 15m59s }"
 
 test_output=$($NFT -e -f - <<< "$RULESET" 2>&1 | grep -v '# new generation' | drop_seconds)

The next line in that file is:

| if [ "$test_output" != "$RULESET" ] ; then

Quoted 7 lines
Quoted 3 lines

You add "59s" to $RULESET and drop it from $test_output. I guess, to make it work, you also need to pipe $RULESET through drop_seconds before the comparison.

Indeed, apologies: See latest patch.

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

Ouch, still fails. Damn, I don't get a proper fix for this script.

author maintainer
#5 lore raw
Quoted 9 lines · Florian Westphal
Quoted 3 lines · Pablo Neira Ayuso
Quoted 1 line

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

Ouch, still fails. Damn, I don't get a proper fix for this script.

What about restoring an expire value of 3s, then check there is *one* element, wait 4s, check element is gone?

Tests are parallelized, so this won't cause noticeable slowdown.

:) I have been running tests for a while and it seems no more spurious errors show with:

https://patchwork.ozlabs.org/project/netfilter-devel/patch/[email protected]/

Not related, next one to look at is:

W: [DUMP FAIL] 31/378 testcases/sets/0062set_connlimit

which occasionally fails. This is because this adds an element:

table ip x {
        set est-connlimit {
                type ipv4_addr
                size 65535
                flags dynamic
                elements = { 84.245.120.167 ct count over 20 }
        }
}

the conncount list is empty, then GC might win race to delete this element with no entries (GC removes empty conncount lists).

I added this test to make sure this restores fine, even if GC removes all elements that has been restored as soon as it gets a chance to run, because the conncount list is empty.

For this one, I can set a larger gc-interval, so GC takes longer time to release it, and still parser coverage for this restoration remains in place.