mirror of
https://github.com/containers/podman.git
synced 2025-06-20 09:03:43 +08:00
Merge pull request #6726 from edsantiago/bats
system tests: invoke with abs path to podman
This commit is contained in:
4
Makefile
4
Makefile
@ -351,7 +351,7 @@ remoteintegration: varlink_generate test-binaries ginkgo-remote
|
|||||||
localsystem:
|
localsystem:
|
||||||
# Wipe existing config, database, and cache: start with clean slate.
|
# Wipe existing config, database, and cache: start with clean slate.
|
||||||
$(RM) -rf ${HOME}/.local/share/containers ${HOME}/.config/containers
|
$(RM) -rf ${HOME}/.local/share/containers ${HOME}/.config/containers
|
||||||
if timeout -v 1 true; then PODMAN=./bin/podman bats test/system/; else echo "Skipping $@: 'timeout -v' unavailable'"; fi
|
if timeout -v 1 true; then PODMAN=$(shell pwd)/bin/podman bats test/system/; else echo "Skipping $@: 'timeout -v' unavailable'"; fi
|
||||||
|
|
||||||
.PHONY: remotesystem
|
.PHONY: remotesystem
|
||||||
remotesystem:
|
remotesystem:
|
||||||
@ -378,7 +378,7 @@ remotesystem:
|
|||||||
echo "Error: ./bin/podman system service did not come up on $$SOCK_FILE" >&2;\
|
echo "Error: ./bin/podman system service did not come up on $$SOCK_FILE" >&2;\
|
||||||
exit 1;\
|
exit 1;\
|
||||||
fi;\
|
fi;\
|
||||||
env PODMAN="./bin/podman-remote --url $$PODMAN_SOCKET" bats test/system/ ;\
|
env PODMAN="$(shell pwd)/bin/podman-remote --url $$PODMAN_SOCKET" bats test/system/ ;\
|
||||||
rc=$$?;\
|
rc=$$?;\
|
||||||
kill %1;\
|
kill %1;\
|
||||||
rm -f $$SOCK_FILE;\
|
rm -f $$SOCK_FILE;\
|
||||||
|
@ -231,6 +231,10 @@ END_HTML
|
|||||||
if ($looks_like_bats) {
|
if ($looks_like_bats) {
|
||||||
my $css;
|
my $css;
|
||||||
|
|
||||||
|
# Readability: /long/path/to/podman -> podman (hover for full path)
|
||||||
|
$line =~ s{^(#\s+(#|\$)\s+)(\S+/)(podman\S*)\s}
|
||||||
|
{$1<span title="$3$4">$4</span> };
|
||||||
|
|
||||||
if ($line =~ /^ok\s.*\s# skip/) { $css = 'skipped' }
|
if ($line =~ /^ok\s.*\s# skip/) { $css = 'skipped' }
|
||||||
elsif ($line =~ /^ok\s/) { $css = 'passed' }
|
elsif ($line =~ /^ok\s/) { $css = 'passed' }
|
||||||
elsif ($line =~ /^not\s+ok\s/) { $css = 'failed' }
|
elsif ($line =~ /^not\s+ok\s/) { $css = 'failed' }
|
||||||
|
@ -88,12 +88,16 @@ __END__
|
|||||||
ok 1 hi
|
ok 1 hi
|
||||||
ok 2 bye # skip no reason
|
ok 2 bye # skip no reason
|
||||||
not ok 3 fail
|
not ok 3 fail
|
||||||
|
# $ /path/to/podman foo -bar
|
||||||
|
# #| FAIL: exit code is 123; expected 321
|
||||||
ok 4 blah
|
ok 4 blah
|
||||||
>>>
|
>>>
|
||||||
1..4
|
1..4
|
||||||
<span class='bats-passed'><a name='t--00001'>ok 1 hi</a></span>
|
<span class='bats-passed'><a name='t--00001'>ok 1 hi</a></span>
|
||||||
<span class='bats-skipped'><a name='t--00002'>ok 2 bye # skip no reason</a></span>
|
<span class='bats-skipped'><a name='t--00002'>ok 2 bye # skip no reason</a></span>
|
||||||
<span class='bats-failed'><a name='t--00003'>not ok 3 fail</a></span>
|
<span class='bats-failed'><a name='t--00003'>not ok 3 fail</a></span>
|
||||||
|
<span class='bats-log'># $ <span title="/path/to/podman">podman</span> foo -bar</span>
|
||||||
|
<span class='bats-log-esm'># #| FAIL: exit code is 123; expected 321</span>
|
||||||
<span class='bats-passed'><a name='t--00004'>ok 4 blah</a></span>
|
<span class='bats-passed'><a name='t--00004'>ok 4 blah</a></span>
|
||||||
<hr/><span class='bats-summary'>Summary: <span class='bats-passed'>2 Passed</span>, <span class='bats-failed'>1 Failed</span>, <span class='bats-skipped'>1 Skipped</span>. Total tests: 4</span>
|
<hr/><span class='bats-summary'>Summary: <span class='bats-passed'>2 Passed</span>, <span class='bats-failed'>1 Failed</span>, <span class='bats-skipped'>1 Skipped</span>. Total tests: 4</span>
|
||||||
|
|
||||||
|
@ -2,12 +2,6 @@
|
|||||||
|
|
||||||
# Podman command to run; may be podman-remote
|
# Podman command to run; may be podman-remote
|
||||||
PODMAN=${PODMAN:-podman}
|
PODMAN=${PODMAN:-podman}
|
||||||
# If it's a relative path, convert to absolute; otherwise tests can't cd out
|
|
||||||
if [[ "$PODMAN" =~ / ]]; then
|
|
||||||
if [[ ! "$PODMAN" =~ ^/ ]]; then
|
|
||||||
PODMAN=$(realpath $PODMAN)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Standard image to use for most tests
|
# Standard image to use for most tests
|
||||||
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
|
PODMAN_TEST_IMAGE_REGISTRY=${PODMAN_TEST_IMAGE_REGISTRY:-"quay.io"}
|
||||||
@ -22,6 +16,12 @@ IMAGE=$PODMAN_TEST_IMAGE_FQN
|
|||||||
# Default timeout for a podman command.
|
# Default timeout for a podman command.
|
||||||
PODMAN_TIMEOUT=${PODMAN_TIMEOUT:-60}
|
PODMAN_TIMEOUT=${PODMAN_TIMEOUT:-60}
|
||||||
|
|
||||||
|
# Prompt to display when logging podman commands; distinguish root/rootless
|
||||||
|
_LOG_PROMPT='$'
|
||||||
|
if [ $(id -u) -eq 0 ]; then
|
||||||
|
_LOG_PROMPT='#'
|
||||||
|
fi
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# BEGIN setup/teardown tools
|
# BEGIN setup/teardown tools
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ function run_podman() {
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# stdout is only emitted upon error; this echo is to help a debugger
|
# stdout is only emitted upon error; this echo is to help a debugger
|
||||||
echo "\$ $PODMAN $*"
|
echo "$_LOG_PROMPT $PODMAN $*"
|
||||||
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
|
# BATS hangs if a subprocess remains and keeps FD 3 open; this happens
|
||||||
# if podman crashes unexpectedly without cleaning up subprocesses.
|
# if podman crashes unexpectedly without cleaning up subprocesses.
|
||||||
run timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN "$@" 3>/dev/null
|
run timeout --foreground -v --kill=10 $PODMAN_TIMEOUT $PODMAN "$@" 3>/dev/null
|
||||||
|
Reference in New Issue
Block a user