add framework to emptyDir test

pull/6/head
Daniel Smith 2015-05-22 13:12:55 -07:00
parent 6ae8c78527
commit 86799cdd9d
2 changed files with 8 additions and 12 deletions

View File

@ -22,22 +22,13 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/latest"
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
. "github.com/onsi/ginkgo"
)
var _ = Describe("emptyDir", func() {
var (
c *client.Client
)
BeforeEach(func() {
var err error
c, err = loadClient()
expectNoError(err)
})
f := NewFramework("emptydir")
It("volume on tmpfs should have the correct mode", func() {
volumePath := "/test-volume"
@ -50,7 +41,7 @@ var _ = Describe("emptyDir", func() {
fmt.Sprintf("--fs_type=%v", volumePath),
fmt.Sprintf("--file_mode=%v", volumePath),
}
testContainerOutput("emptydir r/w on tmpfs", c, pod, []string{
f.TestContainerOutput("emptydir r/w on tmpfs", pod, []string{
"mount type of \"/test-volume\": tmpfs",
"mode of file \"/test-volume\": dtrwxrwxrwx", // we expect the sticky bit (mode flag t) to be set for the dir
})
@ -69,7 +60,7 @@ var _ = Describe("emptyDir", func() {
fmt.Sprintf("--rw_new_file=%v", filePath),
fmt.Sprintf("--file_mode=%v", filePath),
}
testContainerOutput("emptydir r/w on tmpfs", c, pod, []string{
f.TestContainerOutput("emptydir r/w on tmpfs", pod, []string{
"mount type of \"/test-volume\": tmpfs",
"mode of file \"/test-volume/test-file\": -rw-r--r--",
"content of file \"/test-volume/test-file\": mount-tester new file",

View File

@ -94,3 +94,8 @@ func (f *Framework) afterEach() {
func (f *Framework) WaitForPodRunning(podName string) error {
return waitForPodRunningInNamespace(f.Client, podName, f.Namespace.Name)
}
// Runs the given pod and verifies that its output matches the desired output.
func (f *Framework) TestContainerOutput(scenarioName string, pod *api.Pod, expectedOutput []string) {
testContainerOutputInNamespace(scenarioName, f.Client, pod, expectedOutput, f.Namespace.Name)
}