Skip to content

Commit a74af3e

Browse files
committed
tests: Test more API filters
Signed-off-by: Stéphane Graber <[email protected]>
1 parent e988131 commit a74af3e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/suites/filtering.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ test_filtering() {
1616

1717
incus init testimage c1
1818
incus init testimage c2
19+
incus project create foo
20+
incus profile create foo
21+
incus network zone create foo
22+
incus network zone record create foo foo
23+
incus network zone record create foo bar
24+
incus network zone create bar
25+
incus network integration create foo ovn
26+
incus network integration create bar ovn
1927

2028
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/instances" --data-urlencode "recursion=0" --data-urlencode "filter=name eq c1" | jq ".metadata | length")
2129
[ "${count}" = "1" ] || false
@@ -32,8 +40,32 @@ test_filtering() {
3240
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/images" --data-urlencode "recursion=1" --data-urlencode "filter=properties.os eq Ubuntu" | jq ".metadata | length")
3341
[ "${count}" = "0" ] || false
3442

43+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/images" --data-urlencode "recursion=0" --data-urlencode "filter=properties.os eq BusyBox" | jq ".metadata | length")
44+
[ "${count}" = "1" ] || false
45+
46+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/projects" --data-urlencode "recursion=0" --data-urlencode "filter=name eq foo" | jq ".metadata | length")
47+
[ "${count}" = "1" ] || false
48+
49+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/profiles" --data-urlencode "recursion=0" --data-urlencode "filter=name eq foo" | jq ".metadata | length")
50+
[ "${count}" = "1" ] || false
51+
52+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/network-zones" --data-urlencode "recursion=0" --data-urlencode "filter=name eq foo" | jq ".metadata | length")
53+
[ "${count}" = "1" ] || false
54+
55+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/network-zones/foo/records" --data-urlencode "recursion=0" --data-urlencode "filter=name eq foo" | jq ".metadata | length")
56+
[ "${count}" = "1" ] || false
57+
58+
count=$(curl -G --unix-socket "$INCUS_DIR/unix.socket" "incus/1.0/network-integrations" --data-urlencode "recursion=0" --data-urlencode "filter=name eq foo" | jq ".metadata | length")
59+
[ "${count}" = "1" ] || false
60+
3561
incus delete c1
3662
incus delete c2
63+
incus project delete foo
64+
incus profile delete foo
65+
incus network zone delete foo
66+
incus network zone delete bar
67+
incus network integration delete foo
68+
incus network integration delete bar
3769
)
3870

3971
kill_incus "${INCUS_FILTERING_DIR}"

0 commit comments

Comments
 (0)