summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2020-06-30 09:11:09 -0600
committerEd Santiago <santiago@redhat.com>2020-06-30 09:42:02 -0600
commitca00067deb12b77e07442a284dc0deac7fcec173 (patch)
tree81d7b5f31e699a49ffacae4a079ede09ce70ae88 /test
parent83bde3bdaf7f7b24f9ad794154207a95e7747f28 (diff)
downloadpodman-ca00067deb12b77e07442a284dc0deac7fcec173.tar.gz
podman-ca00067deb12b77e07442a284dc0deac7fcec173.tar.bz2
podman-ca00067deb12b77e07442a284dc0deac7fcec173.zip
APIv2 tests: usability: better test logging
test-apiv2 has two basic comparisons of returned JSON: equality and likeness ('=' and '~'). When logging failures, the test runner shows both actual and expected values. When logging success, for '=' there's no need to show both actual and expected. But for '~', it can be helpful (for verifying test correctness) to show the actual returned value. To be specific: old: ok ... .MemTotal~[0-9]\+ new: ok ... .MemTotal ('33509068800') ~ [0-9]\+ old: ok ... .[0].State~\(exited\|stopped\) new: ok ... .[0].State ('exited') ~ \(exited\|stopped\) The main benefit is that a developer or end user can easily see precisely what was returned; this can help confirm that the test is working as intended, and/or help fine-tune how the test is written. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/apiv2/test-apiv22
1 files changed, 1 insertions, 1 deletions
diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2
index 7a3518df2..d0bf28b9a 100755
--- a/test/apiv2/test-apiv2
+++ b/test/apiv2/test-apiv2
@@ -84,7 +84,7 @@ function like() {
if expr "$actual" : "$expect" &>/dev/null; then
# On success, include expected value; this helps readers understand
- _show_ok 1 "$testname~$expect"
+ _show_ok 1 "$testname ('$actual') ~ $expect"
return
fi
_show_ok 0 "$testname" "~ $expect" "$actual"