summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-03-23 21:10:16 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-03-23 21:10:16 +0100
commit48509af4bc2a60c368c46f1351ddf5370e012bc0 (patch)
treeeffc5a849954f259e56f1c01311241029972a9a6 /tests
parentf4cc1901f1387faac6df3032ddf73f2a52da4fde (diff)
list:set timeout variant fixes
- the timeout value was actually not set - the garbage collector was broken The variant is fixed, the tests to the testsuite are added.
Diffstat (limited to 'tests')
-rw-r--r--tests/setlist.t30
-rw-r--r--tests/setlist.t.restore10
2 files changed, 37 insertions, 3 deletions
diff --git a/tests/setlist.t b/tests/setlist.t
index b5e060d..6d9371d 100644
--- a/tests/setlist.t
+++ b/tests/setlist.t
@@ -29,7 +29,7 @@
# Test foo,after,bar
1 ipset -T test foo,after,bar
# Save sets
-0 ipset -S > setlist.t.restore
+0 ipset -S > setlist.t.r
# Delete bar,before,foo
1 ipset -D test bar,before,foo
# Delete foo,after,bar
@@ -43,7 +43,7 @@
# Delete all sets
0 ipset -X
# Restore saved sets
-0 ipset -R < setlist.t.restore
+0 ipset -R < setlist.t.r
# List set
0 ipset -L test > .foo
# Check listing
@@ -51,5 +51,29 @@
# Flush all sets
0 ipset -F
# Delete all sets
-0 ipset -X && rm setlist.t.restore
+0 ipset -X && rm setlist.t.r
+# Restore list:set with timeout
+0 ipset -R < setlist.t.restore
+# Add set "before" last one
+0 ipset add test e before d
+# Check reference number of the pushed off set
+0 ref=`ipset list d | grep References | sed 's/References: //'` && test $ref -eq 0
+# Try to add already added set
+1 ipset add test a
+# Check reference number of added set
+0 ref=`ipset list a | grep References | sed 's/References: //'` && test $ref -eq 1
+# Try to add already added set with exist flag
+0 ipset add test a -!
+# Check reference number of added set
+0 ref=`ipset list a | grep References | sed 's/References: //'` && test $ref -eq 1
+# Delete set from the set
+0 ipset del test a
+# Check reference number of deleted set
+0 ref=`ipset list a | grep References | sed 's/References: //'` && test $ref -eq 0
+# Sleep 10s so that entries can time out
+0 sleep 10
+# Check reference numbers of the sets
+0 ref=`ipset list | grep 'References: 1' | wc -l` && test $ref -eq 0
+# Delete all sets
+0 ipset -x
# eof
diff --git a/tests/setlist.t.restore b/tests/setlist.t.restore
new file mode 100644
index 0000000..55c145b
--- /dev/null
+++ b/tests/setlist.t.restore
@@ -0,0 +1,10 @@
+create a hash:ip
+create b hash:ip
+create c hash:ip
+create d hash:ip
+create e hash:ip
+create test list:set timeout 5 size 4
+add test a
+add test b
+add test c
+add test d