Commit c2f3c483 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42363 from copejon/extract-volume-utils

Automatic merge from submit-queue Extract e2e utility code into framework **What this PR does / why we need it**: There's a growing dependency on Volume e2e utilities related to creating / test against NFS volumes. For this reason, it's useful to relocate the relevant functions to the `framework` pkg. Doing so makes these utility functions available to e2e tests outside the `e2e` package. This PR only moves code from the `e2e` package to `framework` and handle the relevant changes in calls. It does not change any logic. ```release-note NONE ``` @jingxu97 I think there's value here in reducing duplicate code in the `common` package, given that these functions have been copied down to it. However, there's been some divergence. Can you PTAL and let me know if there's any reason we can't remove the duplicate `common` code? cc @jeffvance
parents aead989b 9f6d7da0
...@@ -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