mirror of
https://github.com/containers/skopeo.git
synced 2026-07-14 13:48:32 +00:00
By default, the JSON encoder from the Go standard library escapes the HTML characters which causes the maintainer output looks strange: "maintainer": "NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e" Instead of: "maintainer": "NGINX Docker Maintainers <docker-maint@nginx.com>" This patch fixes this issue in "buildah-inspect" only as this is the only place that such characters are displayed. Note: if the output of "buildah-inspect" is piped or redirected then the HTML characters are not escaped. Signed-off-by: Boaz Shuster <ripcurld.github@gmail.com> Closes: #421 Approved by: rhatdan
41 lines
1.4 KiB
Bash
41 lines
1.4 KiB
Bash
#!/usr/bin/env bats
|
|
|
|
load helpers
|
|
|
|
@test "inspect-json" {
|
|
cid=$(buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json scratch)
|
|
run buildah --debug=false inspect "$cid"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" != "" ]
|
|
}
|
|
|
|
@test "inspect-format" {
|
|
cid=$(buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json scratch)
|
|
run buildah --debug=false inspect --format '{{.}}' "$cid"
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" != "" ]
|
|
}
|
|
|
|
@test "inspect-image" {
|
|
cid=$(buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json scratch)
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid scratchy-image
|
|
run buildah --debug=false inspect --type image scratchy-image
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" != "" ]
|
|
run buildah --debug=false inspect --type image scratchy-image:latest
|
|
[ "$status" -eq 0 ]
|
|
[ "$output" != "" ]
|
|
}
|
|
|
|
@test "HTML escaped" {
|
|
cid=$(buildah from --pull=false --signature-policy ${TESTSDIR}/policy.json scratch)
|
|
buildah config --label maintainer="Darth Vader <dvader@darkside.io>" ${cid}
|
|
buildah commit --signature-policy ${TESTSDIR}/policy.json $cid darkside-image
|
|
buildah rm ${cid}
|
|
output=$(buildah inspect --type image darkside-image)
|
|
[ $(output | grep "u003" | wc -l) -eq 0 ]
|
|
output=$(buildah inspect --type image darkside-image | grep "u003" | wc -l)
|
|
[ "$output" -ne 0 ]
|
|
buildah rmi darkside-image
|
|
}
|