summaryrefslogtreecommitdiff
path: root/test/system/000-TEMPLATE
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-04-20 08:13:31 -0600
committerEd Santiago <santiago@redhat.com>2022-04-20 16:14:42 -0600
commit97ee4114655a9442a34130632c47eea5861ca73b (patch)
tree74e1d2b2b700c1db6def8cdcfd6e5b84e5d30e79 /test/system/000-TEMPLATE
parent6250667aa1c1057f77b1f5c19af2015006eb1af5 (diff)
downloadpodman-97ee4114655a9442a34130632c47eea5861ca73b.tar.gz
podman-97ee4114655a9442a34130632c47eea5861ca73b.tar.bz2
podman-97ee4114655a9442a34130632c47eea5861ca73b.zip
system tests: add assert(), and start using it
Problem: the system test 'is()' checker was poorly thought out. For example, there is no way to check for inequality or for absence of a substring. Solution, step 1: introduce new assert(), copied almost verbatim from buildah, where it has been successful in addressing the gaps in is(). The logical next step is to search the tests for 'die' and for 'run', looking for negative assertions which we can replace with assert(). There were a lot, and in the process I found a number of ugly bugs in the tests themselves. I've taken the liberty of fixing these. Important note: at this time we have both assert() and is(). Replacing all instances of is() would be impossible to review. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/system/000-TEMPLATE')
-rw-r--r--test/system/000-TEMPLATE10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/system/000-TEMPLATE b/test/system/000-TEMPLATE
index 85e25e921..a6a9ca141 100644
--- a/test/system/000-TEMPLATE
+++ b/test/system/000-TEMPLATE
@@ -10,7 +10,7 @@ load helpers
@test "podman subcmd - description of this particular test" {
args="some sort of argument list"
run_podman subcmd $args
- is "$output" "what we expect" "output from 'podman subcmd $args'"
+ assert "$output" == "what we expect" "output from 'podman subcmd $args'"
}
# vim: filetype=sh
@@ -66,7 +66,7 @@ function teardown() {
# FIXME: example of dprint. This will trigger if PODMAN_TEST_DEBUG=FOO
# FIXME: ...or anything that matches the name assigned in the @test line.
dprint "podman logs $cid -> '$output'"
- is "$output" "what are we expecting?" "description of this check"
+ assert "$output" == "what are we expecting?" "description of this check"
# Clean up
run_podman rm $cid
@@ -90,7 +90,7 @@ size | -\\\?[0-9]\\\+
run_podman history --format json $IMAGE
# FIXME: parse_table is what does all the work, giving us test cases.
- parse_table "$tests" | while read field expect; do
+ while read field expect; do
# FIXME: this shows a drawback of BATS and bash: we can't include '|'
# FIXME: in the table, but we need to because some images don't
# FIXME: have a CID. So, yeah, this is ugly -- but rare.
@@ -104,10 +104,10 @@ size | -\\\?[0-9]\\\+
# FIXME: please be sure to note the third field!
# FIXME: that's the test name. Make it something useful! Include
# FIXME: loop variables whenever possible. Don't just say "my test"
- is "$actual" "$expect\$" "jq .[$i].$field"
+ assert "$actual" =~ "$expect\$" "jq .[$i].$field"
i=$(expr $i + 1)
done
- done
+ done < <(parse_table "$tests")
}