e2e_node: clean up non-recommended import

This commit is contained in:
SataQiu
2019-07-28 12:49:36 +08:00
parent 23649560c0
commit 641d330f89
35 changed files with 763 additions and 763 deletions

View File

@@ -54,8 +54,8 @@ import (
frameworkmetrics "k8s.io/kubernetes/test/e2e/framework/metrics"
imageutils "k8s.io/kubernetes/test/utils/image"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
)
// TODO(random-liu): Get this automatically from kubelet flag.
@@ -137,10 +137,10 @@ func getCurrentKubeletConfig() (*kubeletconfig.KubeletConfiguration, error) {
// Returns true on success.
func tempSetCurrentKubeletConfig(f *framework.Framework, updateFunction func(initialConfig *kubeletconfig.KubeletConfiguration)) {
var oldCfg *kubeletconfig.KubeletConfiguration
BeforeEach(func() {
ginkgo.BeforeEach(func() {
configEnabled, err := isKubeletConfigEnabled(f)
framework.ExpectNoError(err)
Expect(configEnabled).To(BeTrue(), "The Dynamic Kubelet Configuration feature is not enabled.\n"+
gomega.Expect(configEnabled).To(gomega.BeTrue(), "The Dynamic Kubelet Configuration feature is not enabled.\n"+
"Pass --feature-gates=DynamicKubeletConfig=true to the Kubelet to enable this feature.\n"+
"For `make test-e2e-node`, you can set `TEST_ARGS='--feature-gates=DynamicKubeletConfig=true'`.")
oldCfg, err = getCurrentKubeletConfig()
@@ -153,7 +153,7 @@ func tempSetCurrentKubeletConfig(f *framework.Framework, updateFunction func(ini
framework.ExpectNoError(setKubeletConfiguration(f, newCfg))
})
AfterEach(func() {
ginkgo.AfterEach(func() {
if oldCfg != nil {
err := setKubeletConfiguration(f, oldCfg)
framework.ExpectNoError(err)
@@ -209,15 +209,15 @@ func setKubeletConfiguration(f *framework.Framework, kubeCfg *kubeletconfig.Kube
}
// set the source, retry a few times in case we are competing with other writers
Eventually(func() error {
gomega.Eventually(func() error {
if err := setNodeConfigSource(f, src); err != nil {
return err
}
return nil
}, time.Minute, time.Second).Should(BeNil())
}, time.Minute, time.Second).Should(gomega.BeNil())
// poll for new config, for a maximum wait of restartGap
Eventually(func() error {
gomega.Eventually(func() error {
newKubeCfg, err := getCurrentKubeletConfig()
if err != nil {
return fmt.Errorf("failed trying to get current Kubelet config, will retry, error: %v", err)
@@ -227,7 +227,7 @@ func setKubeletConfiguration(f *framework.Framework, kubeCfg *kubeletconfig.Kube
}
klog.Infof("new configuration has taken effect")
return nil
}, restartGap, pollInterval).Should(BeNil())
}, restartGap, pollInterval).Should(gomega.BeNil())
return nil
}
@@ -265,7 +265,7 @@ func pollConfigz(timeout time.Duration, pollInterval time.Duration) *http.Respon
req.Header.Add("Accept", "application/json")
var resp *http.Response
Eventually(func() bool {
gomega.Eventually(func() bool {
resp, err = client.Do(req)
if err != nil {
klog.Errorf("Failed to get /configz, retrying. Error: %v", err)
@@ -276,7 +276,7 @@ func pollConfigz(timeout time.Duration, pollInterval time.Duration) *http.Respon
return false
}
return true
}, timeout, pollInterval).Should(Equal(true))
}, timeout, pollInterval).Should(gomega.Equal(true))
return resp
}
@@ -347,7 +347,7 @@ func logNodeEvents(f *framework.Framework) {
func getLocalNode(f *framework.Framework) *v1.Node {
nodeList := framework.GetReadySchedulableNodesOrDie(f.ClientSet)
Expect(len(nodeList.Items)).To(Equal(1), "Unexpected number of node objects for node e2e. Expects only one node.")
gomega.Expect(len(nodeList.Items)).To(gomega.Equal(1), "Unexpected number of node objects for node e2e. Expects only one node.")
return &nodeList.Items[0]
}
@@ -423,7 +423,7 @@ func restartKubelet() {
framework.ExpectNoError(err)
regex := regexp.MustCompile("(kubelet-\\w+)")
matches := regex.FindStringSubmatch(string(stdout))
Expect(len(matches)).NotTo(BeZero())
gomega.Expect(len(matches)).NotTo(gomega.BeZero())
kube := matches[0]
e2elog.Logf("Get running kubelet with systemctl: %v, %v", string(stdout), kube)
stdout, err = exec.Command("sudo", "systemctl", "restart", kube).CombinedOutput()