Introduce subPath in VolumeMount

This commit is contained in:
Mikaël Cluseau
2016-03-05 12:40:15 +11:00
parent 79a9a14c6f
commit 06900a934d
7 changed files with 76 additions and 1 deletions

View File

@@ -88,6 +88,37 @@ var _ = framework.KubeDescribe("hostPath", func() {
}, namespace.Name,
)
})
It("should support subPath [Conformance]", func() {
volumePath := "/test-volume"
subPath := "sub-path"
fileName := "test-file"
retryDuration := 180
filePathInWriter := path.Join(volumePath, fileName)
filePathInReader := path.Join(volumePath, subPath, fileName)
source := &api.HostPathVolumeSource{
Path: "/tmp",
}
pod := testPodWithHostVol(volumePath, source)
// Write the file in the subPath from container 0
container := &pod.Spec.Containers[0]
container.VolumeMounts[0].SubPath = subPath
container.Args = []string{
fmt.Sprintf("--new_file_0644=%v", filePathInWriter),
fmt.Sprintf("--file_mode=%v", filePathInWriter),
}
// Read it from outside the subPath from container 1
pod.Spec.Containers[1].Args = []string{
fmt.Sprintf("--file_content_in_loop=%v", filePathInReader),
fmt.Sprintf("--retry_time=%d", retryDuration),
}
framework.TestContainerOutput("hostPath subPath", c, pod, 1, []string{
"content of file \"" + filePathInReader + "\": mount-tester new file",
}, namespace.Name)
})
})
//These constants are borrowed from the other test.