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

@@ -46,10 +46,10 @@ import (
"k8s.io/kubernetes/test/e2e/generated"
"k8s.io/kubernetes/test/e2e_node/services"
. "github.com/onsi/ginkgo"
"github.com/onsi/ginkgo"
"github.com/onsi/ginkgo/config"
morereporters "github.com/onsi/ginkgo/reporters"
. "github.com/onsi/gomega"
"github.com/onsi/gomega"
"github.com/spf13/pflag"
"k8s.io/klog"
)
@@ -131,8 +131,8 @@ func TestE2eNode(t *testing.T) {
return
}
// If run-services-mode is not specified, run test.
RegisterFailHandler(Fail)
reporters := []Reporter{}
gomega.RegisterFailHandler(ginkgo.Fail)
reporters := []ginkgo.Reporter{}
reportDir := framework.TestContext.ReportDir
if reportDir != "" {
// Create the directory if it doesn't already exists
@@ -145,13 +145,13 @@ func TestE2eNode(t *testing.T) {
reporters = append(reporters, morereporters.NewJUnitReporter(junitPath))
}
}
RunSpecsWithDefaultAndCustomReporters(t, "E2eNode Suite", reporters)
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "E2eNode Suite", reporters)
}
// Setup the kubelet on the node
var _ = SynchronizedBeforeSuite(func() []byte {
var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
// Run system validation test.
Expect(validateSystem()).To(Succeed(), "system validation")
gomega.Expect(validateSystem()).To(gomega.Succeed(), "system validation")
// Pre-pull the images tests depend on so we can fail immediately if there is an image pull issue
// This helps with debugging test flakes since it is hard to tell when a test failure is due to image pulling.
@@ -159,7 +159,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
klog.Infof("Pre-pulling images so that they are cached for the tests.")
updateImageWhiteList()
err := PrePullAllImages()
Expect(err).ShouldNot(HaveOccurred())
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
}
// TODO(yifan): Temporary workaround to disable coreos from auto restart
@@ -171,7 +171,7 @@ var _ = SynchronizedBeforeSuite(func() []byte {
// If the services are expected to stop after test, they should monitor the test process.
// If the services are expected to keep running after test, they should not monitor the test process.
e2es = services.NewE2EServices(*stopServices)
Expect(e2es.Start()).To(Succeed(), "should be able to start node services.")
gomega.Expect(e2es.Start()).To(gomega.Succeed(), "should be able to start node services.")
klog.Infof("Node services started. Running tests...")
} else {
klog.Infof("Running tests without starting services.")
@@ -186,11 +186,11 @@ var _ = SynchronizedBeforeSuite(func() []byte {
return nil
}, func([]byte) {
// update test context with node configuration.
Expect(updateTestContext()).To(Succeed(), "update test context with node config.")
gomega.Expect(updateTestContext()).To(gomega.Succeed(), "update test context with node config.")
})
// Tear down the kubelet on the node
var _ = SynchronizedAfterSuite(func() {}, func() {
var _ = ginkgo.SynchronizedAfterSuite(func() {}, func() {
if e2es != nil {
if *startServices && *stopServices {
klog.Infof("Stopping node services...")
@@ -240,7 +240,7 @@ func waitForNodeReady() {
)
client, err := getAPIServerClient()
framework.ExpectNoError(err, "should be able to get apiserver client.")
Eventually(func() error {
gomega.Eventually(func() error {
node, err := getNode(client)
if err != nil {
return fmt.Errorf("failed to get node: %v", err)
@@ -249,7 +249,7 @@ func waitForNodeReady() {
return fmt.Errorf("node is not ready: %+v", node)
}
return nil
}, nodeReadyTimeout, nodeReadyPollInterval).Should(Succeed())
}, nodeReadyTimeout, nodeReadyPollInterval).Should(gomega.Succeed())
}
// updateTestContext updates the test context with the node name.
@@ -287,7 +287,7 @@ func getNode(c *clientset.Clientset) (*v1.Node, error) {
if nodes == nil {
return nil, fmt.Errorf("the node list is nil.")
}
Expect(len(nodes.Items) > 1).NotTo(BeTrue(), "the number of nodes is more than 1.")
gomega.Expect(len(nodes.Items) > 1).NotTo(gomega.BeTrue(), "the number of nodes is more than 1.")
if len(nodes.Items) == 0 {
return nil, fmt.Errorf("empty node list: %+v", nodes)
}