summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-22 20:57:14 +0200
committerGitHub <noreply@github.com>2020-04-22 20:57:14 +0200
commit9a910efcf65aa277ccf558e76fd0ead96559eb11 (patch)
tree7ca955380a88467aea0001c948dd1d2412ee2d3c
parent366fc0520b1503556a177aa2fd29f529f8874544 (diff)
parentd422799595f0c8b47a7ee022db73124a48c835d6 (diff)
downloadpodman-9a910efcf65aa277ccf558e76fd0ead96559eb11.tar.gz
podman-9a910efcf65aa277ccf558e76fd0ead96559eb11.tar.bz2
podman-9a910efcf65aa277ccf558e76fd0ead96559eb11.zip
Merge pull request #5202 from QiWang19/path-config-storageconf
test rootless_storage_path from storage.conf
-rw-r--r--test/e2e/info_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index ff3615dcd..7cb299e0f 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -1,8 +1,13 @@
package integration
import (
+ "fmt"
+ "io/ioutil"
"os"
+ "os/exec"
+ "path/filepath"
+ "github.com/containers/libpod/pkg/rootless"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -50,4 +55,41 @@ var _ = Describe("Podman Info", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring("registry"))
})
+
+ It("podman info rootless storage path", func() {
+ if !rootless.IsRootless() {
+ Skip("test of rootless_storage_path is only meaningful as rootless")
+ }
+ SkipIfRemote()
+ oldHOME, hasHOME := os.LookupEnv("HOME")
+ defer func() {
+ if hasHOME {
+ os.Setenv("HOME", oldHOME)
+ } else {
+ os.Unsetenv("HOME")
+ }
+ }()
+ os.Setenv("HOME", podmanTest.TempDir)
+ configPath := filepath.Join(os.Getenv("HOME"), ".config", "containers", "storage.conf")
+ err := os.RemoveAll(filepath.Dir(configPath))
+ Expect(err).To(BeNil())
+
+ err = os.MkdirAll(filepath.Dir(configPath), os.ModePerm)
+ Expect(err).To(BeNil())
+
+ rootlessStoragePath := `"/tmp/$HOME/$USER/$UID"`
+ driver := `"overlay"`
+ storageOpt := `"/usr/bin/fuse-overlayfs"`
+ storageConf := []byte(fmt.Sprintf("[storage]\ndriver=%s\nrootless_storage_path=%s\n[storage.options]\nmount_program=%s", driver, rootlessStoragePath, storageOpt))
+ err = ioutil.WriteFile(configPath, storageConf, os.ModePerm)
+ Expect(err).To(BeNil())
+
+ expect := filepath.Join("/tmp", os.Getenv("HOME"), os.Getenv("USER"), os.Getenv("UID"))
+ podmanPath := podmanTest.PodmanTest.PodmanBinary
+ cmd := exec.Command(podmanPath, "info", "--format", "{{.Store.GraphRoot}}")
+ out, err := cmd.CombinedOutput()
+ fmt.Println(string(out))
+ Expect(err).To(BeNil())
+ Expect(string(out)).To(ContainSubstring(expect))
+ })
})