Commit cef9edcd authored by Jon Cope's avatar Jon Cope

Extract volume test utils into framework.

Moved remaining util functions moved cinder specific function back to volumes.go, will have to be extracted later when a cinder e2e package is created. remove dupe code from common/volume.go Moved [Volume] tags to KubeDescribe
parent 879f8e0c
...@@ -51,7 +51,6 @@ go_library( ...@@ -51,7 +51,6 @@ go_library(
"//vendor:github.com/onsi/ginkgo", "//vendor:github.com/onsi/ginkgo",
"//vendor:github.com/onsi/gomega", "//vendor:github.com/onsi/gomega",
"//vendor:golang.org/x/net/websocket", "//vendor:golang.org/x/net/websocket",
"//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/api/resource", "//vendor:k8s.io/apimachinery/pkg/api/resource",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1", "//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/fields", "//vendor:k8s.io/apimachinery/pkg/fields",
......
...@@ -35,6 +35,7 @@ go_library( ...@@ -35,6 +35,7 @@ go_library(
"test_context.go", "test_context.go",
"upgrade_util.go", "upgrade_util.go",
"util.go", "util.go",
"volume_util.go",
], ],
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
......
...@@ -134,9 +134,9 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem ...@@ -134,9 +134,9 @@ func updateNodeLabels(c clientset.Interface, nodeNames sets.String, toAdd, toRem
// ip address. // ip address.
// Note: startVolumeServer() waits for the nfs-server pod to be Running and sleeps some // Note: startVolumeServer() waits for the nfs-server pod to be Running and sleeps some
// so that the nfs server can start up. // so that the nfs server can start up.
func createNfsServerPod(c clientset.Interface, config VolumeTestConfig) (*v1.Pod, string) { func createNfsServerPod(c clientset.Interface, config framework.VolumeTestConfig) (*v1.Pod, string) {
pod := startVolumeServer(c, config) pod := framework.StartVolumeServer(c, config)
Expect(pod).NotTo(BeNil()) Expect(pod).NotTo(BeNil())
ip := pod.Status.PodIP ip := pod.Status.PodIP
Expect(len(ip)).NotTo(BeZero()) Expect(len(ip)).NotTo(BeZero())
...@@ -387,7 +387,7 @@ var _ = framework.KubeDescribe("kubelet", func() { ...@@ -387,7 +387,7 @@ var _ = framework.KubeDescribe("kubelet", func() {
var ( var (
nfsServerPod *v1.Pod nfsServerPod *v1.Pod
nfsIP string nfsIP string
NFSconfig VolumeTestConfig NFSconfig framework.VolumeTestConfig
pod *v1.Pod // client pod pod *v1.Pod // client pod
) )
...@@ -404,12 +404,12 @@ var _ = framework.KubeDescribe("kubelet", func() { ...@@ -404,12 +404,12 @@ var _ = framework.KubeDescribe("kubelet", func() {
} }
BeforeEach(func() { BeforeEach(func() {
NFSconfig = VolumeTestConfig{ NFSconfig = framework.VolumeTestConfig{
namespace: ns, Namespace: ns,
prefix: "nfs", Prefix: "nfs",
serverImage: NfsServerImage, ServerImage: framework.NfsServerImage,
serverPorts: []int{2049}, ServerPorts: []int{2049},
serverArgs: []string{"-G", "777", "/exports"}, ServerArgs: []string{"-G", "777", "/exports"},
} }
nfsServerPod, nfsIP = createNfsServerPod(c, NFSconfig) nfsServerPod, nfsIP = createNfsServerPod(c, NFSconfig)
}) })
......
...@@ -14,10 +14,6 @@ See the License for the specific language governing permissions and ...@@ -14,10 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
// This test references
// persistent_volumes.go
// volumes.go
package e2e package e2e
import ( import (
......
...@@ -77,12 +77,12 @@ func completeMultiTest(f *framework.Framework, c clientset.Interface, ns string, ...@@ -77,12 +77,12 @@ func completeMultiTest(f *framework.Framework, c clientset.Interface, ns string,
// initNFSserverPod wraps volumes.go's startVolumeServer to return a running nfs host pod // initNFSserverPod wraps volumes.go's startVolumeServer to return a running nfs host pod
// commonly used by persistent volume testing // commonly used by persistent volume testing
func initNFSserverPod(c clientset.Interface, ns string) *v1.Pod { func initNFSserverPod(c clientset.Interface, ns string) *v1.Pod {
return startVolumeServer(c, VolumeTestConfig{ return framework.StartVolumeServer(c, framework.VolumeTestConfig{
namespace: ns, Namespace: ns,
prefix: "nfs", Prefix: "nfs",
serverImage: NfsServerImage, ServerImage: framework.NfsServerImage,
serverPorts: []int{2049}, ServerPorts: []int{2049},
serverArgs: []string{"-G", "777", "/exports"}, ServerArgs: []string{"-G", "777", "/exports"},
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment