test: add test for rootless export
@@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
+ "strings"
"syscall"
. "github.com/containers/libpod/test/utils"
@@ -245,6 +246,22 @@ var _ = Describe("Podman rootless", func() {
cmd.WaitWithDefaultTimeout()
Expect(cmd.ExitCode()).To(Equal(0))
Expect(cmd.LineInOutputContains("hello")).To(BeTrue())
+
+ cmd = rootlessTest.PodmanAsUser([]string{"ps", "-l", "-q"}, 1000, 1000, env)
+ cmd.WaitWithDefaultTimeout()
+ Expect(cmd.ExitCode()).To(Equal(0))
+ cid := cmd.OutputToString()
+
+ cmd = rootlessTest.PodmanAsUser([]string{"exec", "-l", "sh", "-c", "echo SeCreTMessage > /file"}, 1000, 1000, env)
+ cmd.WaitWithDefaultTimeout()
+ Expect(cmd.ExitCode()).To(Equal(0))
+
+ path := filepath.Join(home, "export.tar")
+ cmd = rootlessTest.PodmanAsUser([]string{"export", "-o", path, cid}, 1000, 1000, env)
+ cmd.WaitWithDefaultTimeout()
+ content, err := ioutil.ReadFile(path)
+ Expect(err).To(BeNil())
+ Expect(strings.Contains(string(content), "SeCreTMessage")).To(BeTrue())
}
runInRootlessContext(f)
}
