mirror of
https://github.com/containers/podman.git
synced 2025-06-21 01:19:15 +08:00
Merge pull request #16309 from edsantiago/remove_usr_bin_podman_in_tests
Test runners: nuke podman from $PATH before tests
This commit is contained in:
@ -146,7 +146,7 @@ exec_container() {
|
|||||||
# VM Images and Container images are built using (nearly) identical operations.
|
# VM Images and Container images are built using (nearly) identical operations.
|
||||||
set -x
|
set -x
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
exec podman run --rm --privileged --net=host --cgroupns=host \
|
exec bin/podman run --rm --privileged --net=host --cgroupns=host \
|
||||||
-v `mktemp -d -p /var/tmp`:/tmp:Z \
|
-v `mktemp -d -p /var/tmp`:/tmp:Z \
|
||||||
-v /dev/fuse:/dev/fuse \
|
-v /dev/fuse:/dev/fuse \
|
||||||
-v "$GOPATH:$GOPATH:Z" \
|
-v "$GOPATH:$GOPATH:Z" \
|
||||||
@ -187,7 +187,7 @@ function _run_swagger() {
|
|||||||
|
|
||||||
# Swagger validation takes a significant amount of time
|
# Swagger validation takes a significant amount of time
|
||||||
msg "Pulling \$CTR_FQIN '$CTR_FQIN' (background process)"
|
msg "Pulling \$CTR_FQIN '$CTR_FQIN' (background process)"
|
||||||
podman pull --quiet $CTR_FQIN &
|
bin/podman pull --quiet $CTR_FQIN &
|
||||||
|
|
||||||
cd $GOSRC
|
cd $GOSRC
|
||||||
make swagger
|
make swagger
|
||||||
@ -209,7 +209,7 @@ eof
|
|||||||
|
|
||||||
msg "Waiting for backgrounded podman pull to complete..."
|
msg "Waiting for backgrounded podman pull to complete..."
|
||||||
wait %%
|
wait %%
|
||||||
podman run -it --rm --security-opt label=disable \
|
bin/podman run -it --rm --security-opt label=disable \
|
||||||
--env-file=$envvarsfile \
|
--env-file=$envvarsfile \
|
||||||
-v $GOSRC:$GOSRC:ro \
|
-v $GOSRC:$GOSRC:ro \
|
||||||
--workdir $GOSRC \
|
--workdir $GOSRC \
|
||||||
@ -375,6 +375,14 @@ dotest() {
|
|||||||
podman) localremote="local" ;;
|
podman) localremote="local" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# We've had some oopsies where tests invoke 'podman' instead of
|
||||||
|
# /path/to/built/podman. Let's catch those.
|
||||||
|
sudo rm -f /usr/bin/podman /usr/bin/podman-remote
|
||||||
|
fallback_podman=$(type -p podman || true)
|
||||||
|
if [[ -n "$fallback_podman" ]]; then
|
||||||
|
die "Found fallback podman '$fallback_podman' in \$PATH; tests require none, as a guarantee that we're testing the right binary."
|
||||||
|
fi
|
||||||
|
|
||||||
make ${localremote}${testsuite} PODMAN_SERVER_LOG=$PODMAN_SERVER_LOG \
|
make ${localremote}${testsuite} PODMAN_SERVER_LOG=$PODMAN_SERVER_LOG \
|
||||||
|& logformatter
|
|& logformatter
|
||||||
}
|
}
|
||||||
|
@ -253,6 +253,16 @@ var _ = Describe("podman system connection", func() {
|
|||||||
u, err := user.Current()
|
u, err := user.Current()
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
Expect(err).ShouldNot(HaveOccurred())
|
||||||
|
|
||||||
|
// Ensure that the remote end uses our built podman
|
||||||
|
if os.Getenv("PODMAN_BINARY") == "" {
|
||||||
|
err = os.Setenv("PODMAN_BINARY", podmanTest.PodmanBinary)
|
||||||
|
Expect(err).ShouldNot(HaveOccurred())
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.Unsetenv("PODMAN_BINARY")
|
||||||
|
}()
|
||||||
|
}
|
||||||
|
|
||||||
cmd := exec.Command(podmanTest.RemotePodmanBinary,
|
cmd := exec.Command(podmanTest.RemotePodmanBinary,
|
||||||
"system", "connection", "add",
|
"system", "connection", "add",
|
||||||
"--default",
|
"--default",
|
||||||
|
@ -27,16 +27,16 @@ var _ = Describe("Podman systemd", func() {
|
|||||||
}
|
}
|
||||||
podmanTest = PodmanTestCreate(tempdir)
|
podmanTest = PodmanTestCreate(tempdir)
|
||||||
podmanTest.Setup()
|
podmanTest.Setup()
|
||||||
systemdUnitFile = `[Unit]
|
systemdUnitFile = fmt.Sprintf(`[Unit]
|
||||||
Description=redis container
|
Description=redis container
|
||||||
[Service]
|
[Service]
|
||||||
Restart=always
|
Restart=always
|
||||||
ExecStart=/usr/bin/podman start -a redis
|
ExecStart=%s start -a redis
|
||||||
ExecStop=/usr/bin/podman stop -t 10 redis
|
ExecStop=%s stop -t 10 redis
|
||||||
KillMode=process
|
KillMode=process
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
`
|
`, podmanTest.PodmanBinary, podmanTest.PodmanBinary)
|
||||||
})
|
})
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
|
Reference in New Issue
Block a user