summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bitmap:ip.t10
-rw-r--r--tests/hash:ip.t8
-rw-r--r--tests/macipmap.t8
-rw-r--r--tests/portmap.t8
-rw-r--r--tests/setlist.t43
-rw-r--r--tests/setlist.t.before4
-rw-r--r--tests/setlist.t.list110
-rw-r--r--tests/setlist.t.list29
-rw-r--r--tests/setlist.t.list38
9 files changed, 108 insertions, 0 deletions
diff --git a/tests/bitmap:ip.t b/tests/bitmap:ip.t
index 40c2a98..271bf89 100644
--- a/tests/bitmap:ip.t
+++ b/tests/bitmap:ip.t
@@ -148,6 +148,16 @@
0 ipset list test > .foo
# Full: Check listing
0 diff -I 'Size in memory.*' .foo bitmap:ip.t.list3 && rm .foo
+# Full: flush set
+0 ipset flush test
+# Full: add element with 1s timeout
+0 ipset add test 1.1.1.1 timeout 1
+# Full: readd element with 3s timeout
+0 ipset add test 1.1.1.1 timeout 3 -exist
+# Full: sleep 2s
+0 sleep 2s
+# Full: check readded element
+0 ipset test test 1.1.1.1
# Full: Delete test set
0 ipset destroy test
# eof
diff --git a/tests/hash:ip.t b/tests/hash:ip.t
index a054751..ce8b14b 100644
--- a/tests/hash:ip.t
+++ b/tests/hash:ip.t
@@ -96,6 +96,14 @@
0 diff -I 'Size in memory.*' .foo hash:ip.t.list1 && rm .foo
# Network: Flush test set
0 ipset -F test
+# Network: add element with 1s timeout
+0 ipset add test 200.100.0.12 timeout 1
+# Network: readd element with 3s timeout
+0 ipset add test 200.100.0.12 timeout 3 -exist
+# Network: sleep 2s
+0 sleep 2s
+# Network: check readded element
+0 ipset test test 200.100.0.12
# Network: Delete test set
0 ipset -X test
# eof
diff --git a/tests/macipmap.t b/tests/macipmap.t
index ddc1393..7332f75 100644
--- a/tests/macipmap.t
+++ b/tests/macipmap.t
@@ -130,6 +130,14 @@
0 diff -I 'Size in memory.*' .foo macipmap.t.list2 && rm .foo
# Range: Flush test set
0 ipset -F test
+# Range: add element with 1s timeout
+0 ipset add test 2.0.200.214,00:11:22:33:44:57 timeout 1
+# Range: readd element with 3s timeout
+0 ipset add test 2.0.200.214,00:11:22:33:44:57 timeout 3 -exist
+# Range: sleep 2s
+0 sleep 2s
+# Range: check readded element
+0 ipset test test 2.0.200.214
# Range: Delete test set
0 ipset -X test
# eof
diff --git a/tests/portmap.t b/tests/portmap.t
index 989a83b..084d68c 100644
--- a/tests/portmap.t
+++ b/tests/portmap.t
@@ -80,6 +80,14 @@
# 0 diff -I 'Size in memory.*' .foo portmap.t.list2 && rm .foo
# Full: Flush test set
0 ipset -F test
+# Full: add element with 1s timeout
+0 ipset add test 567 timeout 1
+# Full: readd element with 3s timeout
+0 ipset add test 567 timeout 3 -exist
+# Full: sleep 2s
+0 sleep 2s
+# Full: check readded element
+0 ipset test test 567
# Full: Delete test set
0 ipset -X test
# eof
diff --git a/tests/setlist.t b/tests/setlist.t
index a322cd4..8dcf54a 100644
--- a/tests/setlist.t
+++ b/tests/setlist.t
@@ -52,6 +52,38 @@
0 ipset -F
# Delete all sets
0 ipset -X && rm setlist.t.r
+# Create sets a, b, c to check before/after in all combinations
+0 ipset restore < setlist.t.before
+# Add set a to test set
+0 ipset add test b
+# Add set c after b
+0 ipset add test c after b
+# Add set a before b
+0 ipset add test a before b
+# List test set
+0 ipset list test > .foo
+# Check listing
+0 diff -I 'Size in memory.*' .foo setlist.t.list1 && rm .foo
+# Test a set before b
+0 ipset test test a before b
+# Test c set after b
+0 ipset test test c after b
+# Delete b set before c
+0 ipset del test b before c
+# List test set
+0 ipset list test > .foo
+# Check listing
+0 diff -I 'Size in memory.*' .foo setlist.t.list2 && rm .foo
+# Delete c set after a
+0 ipset del test c after a
+# List test set
+0 ipset list test > .foo
+# Check listing
+0 diff -I 'Size in memory.*' .foo setlist.t.list3 && rm .foo
+# Flush sets
+0 ipset flush
+# Destroy sets
+0 ipset destroy
# Restore list:set with timeout
0 ipset -R < setlist.t.restore
# Add set "before" last one
@@ -84,6 +116,17 @@
0 sleep 10
# Check reference numbers of the sets
0 ref=`ipset list | grep 'References: 1' | wc -l` && test $ref -eq 0
+# Flush test set
+0 ipset flush test
+# Add element with 1s timeout
+0 ipset add test a timeout 1
+# Readd element with 3s timeout
+0 ipset add test a timeout 3 -exist
+# Sleep 2s
+# Check readded element
+0 ipset test test a
+# Flush all sets
+0 ipset flush
# Delete all sets
0 ipset -x
# eof
diff --git a/tests/setlist.t.before b/tests/setlist.t.before
new file mode 100644
index 0000000..59ee644
--- /dev/null
+++ b/tests/setlist.t.before
@@ -0,0 +1,4 @@
+create a hash:ip
+create b hash:ip
+create c hash:ip
+create test list:set
diff --git a/tests/setlist.t.list1 b/tests/setlist.t.list1
new file mode 100644
index 0000000..7bba167
--- /dev/null
+++ b/tests/setlist.t.list1
@@ -0,0 +1,10 @@
+Name: test
+Type: list:set
+Header: size 8
+Size in memory: 120
+References: 0
+Members:
+a
+b
+c
+
diff --git a/tests/setlist.t.list2 b/tests/setlist.t.list2
new file mode 100644
index 0000000..2dc752a
--- /dev/null
+++ b/tests/setlist.t.list2
@@ -0,0 +1,9 @@
+Name: test
+Type: list:set
+Header: size 8
+Size in memory: 120
+References: 0
+Members:
+a
+c
+
diff --git a/tests/setlist.t.list3 b/tests/setlist.t.list3
new file mode 100644
index 0000000..5abe9e4
--- /dev/null
+++ b/tests/setlist.t.list3
@@ -0,0 +1,8 @@
+Name: test
+Type: list:set
+Header: size 8
+Size in memory: 120
+References: 0
+Members:
+a
+