aboutsummaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/play_build_test.go47
-rw-r--r--test/e2e/volume_plugin_test.go8
2 files changed, 52 insertions, 3 deletions
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 70e042b4d..849ba7162 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -212,6 +212,53 @@ LABEL marge=mom
Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom"))
})
+ It("Do not build image at all if --build=false", func() {
+ // Setup
+ yamlDir := filepath.Join(tempdir, RandomString(12))
+ err := os.Mkdir(yamlDir, 0755)
+ Expect(err).To(BeNil(), "mkdir "+yamlDir)
+ err = writeYaml(testYAML, filepath.Join(yamlDir, "top.yaml"))
+ Expect(err).To(BeNil())
+
+ // build an image called foobar but make sure it doesn't have
+ // the same label as the yaml buildfile, so we can check that
+ // the image is NOT rebuilt.
+ err = writeYaml(prebuiltImage, filepath.Join(yamlDir, "Containerfile"))
+ Expect(err).To(BeNil())
+
+ app1Dir := filepath.Join(yamlDir, "foobar")
+ err = os.Mkdir(app1Dir, 0755)
+ Expect(err).To(BeNil())
+ err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
+ Expect(err).To(BeNil())
+ // Write a file to be copied
+ err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
+ Expect(err).To(BeNil())
+
+ // Switch to temp dir and restore it afterwards
+ cwd, err := os.Getwd()
+ Expect(err).To(BeNil())
+ Expect(os.Chdir(yamlDir)).To(BeNil())
+ defer func() { (Expect(os.Chdir(cwd)).To(BeNil())) }()
+
+ // Build the image into the local store
+ build := podmanTest.Podman([]string{"build", "-t", "foobar", "-f", "Containerfile"})
+ build.WaitWithDefaultTimeout()
+ Expect(build).Should(Exit(0))
+
+ session := podmanTest.Podman([]string{"play", "kube", "--build=false", "top.yaml"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"container", "inspect", "top_pod-foobar"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ inspectData := inspect.InspectContainerToJSON()
+ Expect(len(inspectData)).To(BeNumerically(">", 0))
+ Expect(inspectData[0].Config.Labels).To(Not(HaveKey("homer")))
+ Expect(inspectData[0].Config.Labels).To(HaveKeyWithValue("marge", "mom"))
+ })
+
It("--build should override image in store", func() {
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go
index 959a44bb8..fd205805d 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -166,11 +166,13 @@ var _ = Describe("Podman volume plugins", func() {
create.WaitWithDefaultTimeout()
Expect(create).Should(Exit(0))
- ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
+ ctr1Name := "ctr1"
+ ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr1Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
ctr1.WaitWithDefaultTimeout()
Expect(ctr1).Should(Exit(0))
- ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
+ ctr2Name := "ctr2"
+ ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr2Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
ctr2.WaitWithDefaultTimeout()
Expect(ctr2).Should(Exit(0))
Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld"))
@@ -178,7 +180,7 @@ var _ = Describe("Podman volume plugins", func() {
// HACK: `volume rm -f` is timing out trying to remove containers using the volume.
// Solution: remove them manually...
// TODO: fix this when I get back
- rmAll := podmanTest.Podman([]string{"rm", "-af"})
+ rmAll := podmanTest.Podman([]string{"rm", "-f", ctr2Name, ctr1Name})
rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0))
})