Test runners: nuke podman from $PATH before tests

We've had some oopsies in system tests:

    podman foo bar
    run podman foo bar

...all of which should be run_podman with underscore. Those
have been passing because /usr/bin/podman is the fallback
from $PATH. In those (few) cases, we haven't actually been
testing the podman we should be testing.

Solution: nuke /usr/bin/podman and podman-remote before
invoking system and unit tests. As an extra level of
paranoia, check for other podmans in $PATH - if any
exist, bail out with a fatal error.

Also: in a few cases where runner.sh invokes podman for
containerized something-something, run bin/podman instead
of podman from $PATH.

Also: fix existing dependencies on /usr/bin/podman

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2022-10-26 11:37:30 -06:00
parent 47bcd10f61
commit f0f12658de
3 changed files with 25 additions and 7 deletions

View File

@@ -253,6 +253,16 @@ var _ = Describe("podman system connection", func() {
u, err := user.Current()
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,
"system", "connection", "add",
"--default",

View File

@@ -27,16 +27,16 @@ var _ = Describe("Podman systemd", func() {
}
podmanTest = PodmanTestCreate(tempdir)
podmanTest.Setup()
systemdUnitFile = `[Unit]
systemdUnitFile = fmt.Sprintf(`[Unit]
Description=redis container
[Service]
Restart=always
ExecStart=/usr/bin/podman start -a redis
ExecStop=/usr/bin/podman stop -t 10 redis
ExecStart=%s start -a redis
ExecStop=%s stop -t 10 redis
KillMode=process
[Install]
WantedBy=default.target
`
`, podmanTest.PodmanBinary, podmanTest.PodmanBinary)
})
AfterEach(func() {