summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/play_kube_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index eb82b3862..5ecfdd6b5 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -169,6 +169,10 @@ spec:
path: {{ .HostPath.Path }}
type: {{ .HostPath.Type }}
{{- end }}
+ {{- if (eq .VolumeType "PersistentVolumeClaim") }}
+ persistentVolumeClaim:
+ claimName: {{ .PersistentVolumeClaim.ClaimName }}
+ {{- end }}
{{ end }}
{{ end }}
status: {}
@@ -699,10 +703,15 @@ type HostPath struct {
Type string
}
+type PersistentVolumeClaim struct {
+ ClaimName string
+}
+
type Volume struct {
VolumeType string
Name string
HostPath
+ PersistentVolumeClaim
}
// getHostPathVolume takes a type and a location for a HostPath
@@ -718,6 +727,18 @@ func getHostPathVolume(vType, vPath string) *Volume {
}
}
+// getHostPathVolume takes a name for a Persistentvolumeclaim
+// volume giving it a default name of volName
+func getPersistentVolumeClaimVolume(vName string) *Volume {
+ return &Volume{
+ VolumeType: "PersistentVolumeClaim",
+ Name: defaultVolName,
+ PersistentVolumeClaim: PersistentVolumeClaim{
+ ClaimName: vName,
+ },
+ }
+}
+
type Env struct {
Name string
Value string
@@ -1389,6 +1410,26 @@ spec:
Expect(inspect.OutputToString()).To(ContainSubstring(correct))
})
+ It("podman play kube test with PersistentVolumeClaim volume", func() {
+ volumeName := "namedVolume"
+
+ ctr := getCtr(withVolumeMount("/test", false), withImage(BB))
+ pod := getPod(withVolume(getPersistentVolumeClaimVolume(volumeName)), withCtr(ctr))
+ err = generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(pod), "--format", "{{ (index .Mounts 0).Type }}:{{ (index .Mounts 0).Name }}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+
+ correct := fmt.Sprintf("volume:%s", volumeName)
+ Expect(inspect.OutputToString()).To(Equal(correct))
+ })
+
It("podman play kube applies labels to pods", func() {
var numReplicas int32 = 5
expectedLabelKey := "key1"