summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-24 09:35:57 -0400
committerGitHub <noreply@github.com>2022-08-24 09:35:57 -0400
commit0f92cf22a69876975ca6ad97a08751bf2008e257 (patch)
treec2d7c6316570b0d4e20350f8152e9b08ef66a36e /test
parent67c4068bb35fd1aad95b1701c94ed11183d0fd66 (diff)
parent0f739355635d5bc4d538cf88009d7af533e7c289 (diff)
downloadpodman-0f92cf22a69876975ca6ad97a08751bf2008e257.tar.gz
podman-0f92cf22a69876975ca6ad97a08751bf2008e257.tar.bz2
podman-0f92cf22a69876975ca6ad97a08751bf2008e257.zip
Merge pull request #15437 from mheon/default_volume_timeout
Add support for containers.conf volume timeouts
Diffstat (limited to 'test')
-rw-r--r--test/e2e/config/containers.conf2
-rw-r--r--test/e2e/volume_create_test.go15
-rw-r--r--test/e2e/volume_plugin_test.go34
-rw-r--r--test/testvol/util.go2
4 files changed, 37 insertions, 16 deletions
diff --git a/test/e2e/config/containers.conf b/test/e2e/config/containers.conf
index c33f32ab4..94bb316b1 100644
--- a/test/e2e/config/containers.conf
+++ b/test/e2e/config/containers.conf
@@ -61,6 +61,8 @@ no_hosts=true
network_cmd_options=["allow_host_loopback=true"]
service_timeout=1234
+volume_plugin_timeout = 15
+
# We need to ensure each test runs on a separate plugin instance...
# For now, let's just make a bunch of plugin paths and have each test use one.
[engine.volume_plugins]
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index 7a975f6a5..499283cab 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -162,19 +162,4 @@ var _ = Describe("Podman volume create", func() {
Expect(inspectOpts).Should(Exit(0))
Expect(inspectOpts.OutputToString()).To(Equal(optionStrFormatExpect))
})
-
- It("podman create volume with o=timeout", func() {
- volName := "testVol"
- timeout := 10
- timeoutStr := "10"
- session := podmanTest.Podman([]string{"volume", "create", "--opt", fmt.Sprintf("o=timeout=%d", timeout), volName})
- session.WaitWithDefaultTimeout()
- Expect(session).Should(Exit(0))
-
- inspectTimeout := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName})
- inspectTimeout.WaitWithDefaultTimeout()
- Expect(inspectTimeout).Should(Exit(0))
- Expect(inspectTimeout.OutputToString()).To(Equal(timeoutStr))
-
- })
})
diff --git a/test/e2e/volume_plugin_test.go b/test/e2e/volume_plugin_test.go
index b585f8dd8..a44e75a54 100644
--- a/test/e2e/volume_plugin_test.go
+++ b/test/e2e/volume_plugin_test.go
@@ -256,4 +256,38 @@ Removed:
Expect(session.OutputToStringArray()).To(ContainElements(localvol, vol2))
Expect(session.ErrorToString()).To(Equal("")) // make no errors are shown
})
+
+ It("volume driver timeouts test", func() {
+ podmanTest.AddImageToRWStore(volumeTest)
+
+ pluginStatePath := filepath.Join(podmanTest.TempDir, "volumes")
+ err := os.Mkdir(pluginStatePath, 0755)
+ Expect(err).ToNot(HaveOccurred())
+
+ // Keep this distinct within tests to avoid multiple tests using the same plugin.
+ pluginName := "testvol6"
+ plugin := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "/run/docker/plugins:/run/docker/plugins", "-v", fmt.Sprintf("%v:%v", pluginStatePath, pluginStatePath), "-d", volumeTest, "--sock-name", pluginName, "--path", pluginStatePath})
+ plugin.WaitWithDefaultTimeout()
+ Expect(plugin).Should(Exit(0))
+
+ volName := "testVolume1"
+ create := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, volName})
+ create.WaitWithDefaultTimeout()
+ Expect(create).Should(Exit(0))
+
+ volInspect := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName})
+ volInspect.WaitWithDefaultTimeout()
+ Expect(volInspect).Should(Exit(0))
+ Expect(volInspect.OutputToString()).To(ContainSubstring("15"))
+
+ volName2 := "testVolume2"
+ create2 := podmanTest.Podman([]string{"volume", "create", "--driver", pluginName, "--opt", "o=timeout=3", volName2})
+ create2.WaitWithDefaultTimeout()
+ Expect(create2).Should(Exit(0))
+
+ volInspect2 := podmanTest.Podman([]string{"volume", "inspect", "--format", "{{ .Timeout }}", volName2})
+ volInspect2.WaitWithDefaultTimeout()
+ Expect(volInspect2).Should(Exit(0))
+ Expect(volInspect2.OutputToString()).To(ContainSubstring("3"))
+ })
})
diff --git a/test/testvol/util.go b/test/testvol/util.go
index b50bb3afb..b4961e097 100644
--- a/test/testvol/util.go
+++ b/test/testvol/util.go
@@ -25,5 +25,5 @@ func getPluginName(pathOrName string) string {
func getPlugin(sockNameOrPath string) (*plugin.VolumePlugin, error) {
path := getSocketPath(sockNameOrPath)
name := getPluginName(sockNameOrPath)
- return plugin.GetVolumePlugin(name, path, 0)
+ return plugin.GetVolumePlugin(name, path, nil, nil)
}