Merge pull request #3758 from edsantiago/bats
implement 'make remotesystem'
This commit is contained in:
commit
d65cb66437
28
Makefile
28
Makefile
|
|
@ -253,10 +253,34 @@ 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 localsystem: 'timeout -v' unavailable'"; fi
|
if timeout -v 1 true; then PODMAN=./bin/podman bats test/system/; else echo "Skipping $@: 'timeout -v' unavailable'"; fi
|
||||||
|
|
||||||
remotesystem:
|
remotesystem:
|
||||||
@echo "remotesystem - unimplemented"
|
# Wipe existing config, database, and cache: start with clean slate.
|
||||||
|
$(RM) -rf ${HOME}/.local/share/containers ${HOME}/.config/containers
|
||||||
|
# Start varlink server using tmp socket; loop-wait for it;
|
||||||
|
# test podman-remote; kill server, clean up tmp socket file.
|
||||||
|
# varlink server spews copious unhelpful output; ignore it.
|
||||||
|
rc=0;\
|
||||||
|
if timeout -v 1 true; then \
|
||||||
|
SOCK_FILE=$(shell mktemp --dry-run --tmpdir io.podman.XXXXXX);\
|
||||||
|
export PODMAN_VARLINK_ADDRESS=unix:$$SOCK_FILE; \
|
||||||
|
./bin/podman varlink --timeout=0 $$PODMAN_VARLINK_ADDRESS &>/dev/null & \
|
||||||
|
retry=5;\
|
||||||
|
while [[ $$retry -ge 0 ]]; do\
|
||||||
|
echo Waiting for varlink server...;\
|
||||||
|
sleep 1;\
|
||||||
|
./bin/podman-remote info &>/dev/null && break;\
|
||||||
|
retry=$$(expr $$retry - 1);\
|
||||||
|
done;\
|
||||||
|
env PODMAN=./bin/podman-remote bats test/system/ ;\
|
||||||
|
rc=$$?;\
|
||||||
|
kill %1;\
|
||||||
|
rm -f $$SOCK_FILE;\
|
||||||
|
else \
|
||||||
|
echo "Skipping $@: 'timeout -v' unavailable'";\
|
||||||
|
fi;\
|
||||||
|
exit $$rc
|
||||||
|
|
||||||
system.test-binary: .install.ginkgo
|
system.test-binary: .install.ginkgo
|
||||||
$(GO) test -c ./test/system
|
$(GO) test -c ./test/system
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,14 @@ function setup() {
|
||||||
@test "podman version emits reasonable output" {
|
@test "podman version emits reasonable output" {
|
||||||
run_podman version
|
run_podman version
|
||||||
|
|
||||||
|
# First line of podman-remote is "Client:<blank>".
|
||||||
|
# Just delete it (i.e. remove the first entry from the 'lines' array)
|
||||||
|
if is_remote; then
|
||||||
|
if expr "${lines[0]}" : "Client:" >/dev/null; then
|
||||||
|
lines=("${lines[@]:1}")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
is "${lines[0]}" "Version:[ ]\+[1-9][0-9.]\+" "Version line 1"
|
is "${lines[0]}" "Version:[ ]\+[1-9][0-9.]\+" "Version line 1"
|
||||||
is "$output" ".*Go Version: \+" "'Go Version' in output"
|
is "$output" ".*Go Version: \+" "'Go Version' in output"
|
||||||
is "$output" ".*RemoteAPI Version: \+" "API version in output"
|
is "$output" ".*RemoteAPI Version: \+" "API version in output"
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,8 @@
|
||||||
load helpers
|
load helpers
|
||||||
|
|
||||||
@test "podman build - basic test" {
|
@test "podman build - basic test" {
|
||||||
if [[ "$PODMAN" =~ -remote ]]; then
|
if is_remote && is_rootless; then
|
||||||
if [ "$(id -u)" -ne 0 ]; then
|
skip "unreliable with podman-remote and rootless; #2972"
|
||||||
skip "unreliable with podman-remote and rootless; #2972"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rand_filename=$(random_string 20)
|
rand_filename=$(random_string 20)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@
|
||||||
load helpers
|
load helpers
|
||||||
|
|
||||||
@test "podman pod top - containers in different PID namespaces" {
|
@test "podman pod top - containers in different PID namespaces" {
|
||||||
|
skip_if_remote "podman-pod does not work with podman-remote"
|
||||||
|
|
||||||
# With infra=false, we don't get a /pause container (we also
|
# With infra=false, we don't get a /pause container (we also
|
||||||
# don't pull k8s.gcr.io/pause )
|
# don't pull k8s.gcr.io/pause )
|
||||||
no_infra='--infra=false'
|
no_infra='--infra=false'
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ on failure.
|
||||||
|
|
||||||
* `skip_if_rootless` - if rootless, skip this test with a helpful message.
|
* `skip_if_rootless` - if rootless, skip this test with a helpful message.
|
||||||
|
|
||||||
|
* `skip_if_remote` - like the above, but skip if testing `podman-remote`
|
||||||
|
|
||||||
* `random_string` - returns a pseudorandom alphanumeric string
|
* `random_string` - returns a pseudorandom alphanumeric string
|
||||||
|
|
||||||
Test files are of the form `NNN-name.bats` where NNN is a three-digit
|
Test files are of the form `NNN-name.bats` where NNN is a three-digit
|
||||||
|
|
|
||||||
|
|
@ -216,26 +216,31 @@ function wait_for_ready {
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# BEGIN miscellaneous tools
|
# BEGIN miscellaneous tools
|
||||||
|
|
||||||
|
# Shortcuts for common needs:
|
||||||
|
function is_rootless() {
|
||||||
|
[ "$(id -u)" -ne 0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
function is_remote() {
|
||||||
|
[[ "$PODMAN" =~ -remote ]]
|
||||||
|
}
|
||||||
|
|
||||||
######################
|
######################
|
||||||
# skip_if_rootless # ...with an optional message
|
# skip_if_rootless # ...with an optional message
|
||||||
######################
|
######################
|
||||||
function skip_if_rootless() {
|
function skip_if_rootless() {
|
||||||
if [ "$(id -u)" -eq 0 ]; then
|
if is_rootless; then
|
||||||
return
|
skip "${1:-not applicable under rootless podman}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
skip "${1:-not applicable under rootless podman}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# skip_if_remote # ...with an optional message
|
# skip_if_remote # ...with an optional message
|
||||||
####################
|
####################
|
||||||
function skip_if_remote() {
|
function skip_if_remote() {
|
||||||
if [[ ! "$PODMAN" =~ -remote ]]; then
|
if is_remote; then
|
||||||
return
|
skip "${1:-test does not work with podman-remote}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
skip "${1:-test does not work with podman-remote}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue