mirror of
https://github.com/containers/podman.git
synced 2026-05-24 16:40:44 -04:00
machine: add test to check config mount
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
. "github.com/onsi/gomega/gexec"
|
||||
"go.podman.io/podman/v6/pkg/machine/define"
|
||||
"go.podman.io/podman/v6/version/rawversion"
|
||||
"go.podman.io/storage/pkg/configfile"
|
||||
)
|
||||
|
||||
const TESTIMAGE = "quay.io/libpod/testimage:20241011"
|
||||
@@ -31,6 +32,27 @@ var _ = Describe("run basic podman commands", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(session).To(Exit(0))
|
||||
|
||||
// Check that we mount the host config dir to the machine /etc/containers and and can write content from the host there.
|
||||
path, err := configfile.UserConfigPath()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = os.MkdirAll(path, 0o755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
content := randomString()
|
||||
f, err := os.Create(filepath.Join(path, "podman-machine-tmpfile"))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
_, err = f.WriteString(content)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
err = f.Close()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
ssh := new(sshMachine).withSSHCommand([]string{"cat /etc/containers/podman-machine-tmpfile"})
|
||||
sshRun, err := mb.setName(name).setCmd(ssh).run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(sshRun).To(Exit(0))
|
||||
Expect(sshRun.outputToString()).To(Equal(content))
|
||||
|
||||
// check some basic podman commands
|
||||
bm := basicMachine{}
|
||||
imgs, err := mb.setCmd(bm.withPodmanCommand([]string{"images", "-q"})).run()
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
@@ -150,6 +150,9 @@ func setup() (string, *machineTestBuilder) {
|
||||
Fail("unable to set home dir on windows")
|
||||
}
|
||||
}
|
||||
if err := os.Setenv("XDG_CONFIG_HOME", filepath.Join(homeDir, ".config")); err != nil {
|
||||
Fail("failed to set XDG_CONFIG_HOME dir")
|
||||
}
|
||||
if err := os.Setenv("XDG_RUNTIME_DIR", homeDir); err != nil {
|
||||
Fail("failed to set xdg_runtime dir")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user