From 19566b9c9f0fe309deaa75ca83af235bab63b587 Mon Sep 17 00:00:00 2001 From: Kenichi Omichi Date: Tue, 10 Mar 2020 17:21:24 +0000 Subject: [PATCH] Remove unused E2ETestNodePreparer and functions Since 59533f0cd1b6a31f8ccd040ecba5055e7cf3fdbe E2ETestNodePreparer and the related functions have been unused. This removes them for cleanup. --- test/e2e/framework/util.go | 61 -------------------------------------- 1 file changed, 61 deletions(-) diff --git a/test/e2e/framework/util.go b/test/e2e/framework/util.go index 2ba9a595269..ceab1173e89 100644 --- a/test/e2e/framework/util.go +++ b/test/e2e/framework/util.go @@ -39,8 +39,6 @@ import ( "golang.org/x/net/websocket" - "k8s.io/klog" - "github.com/onsi/ginkgo" "github.com/onsi/gomega" gomegatypes "github.com/onsi/gomega/types" @@ -1687,65 +1685,6 @@ func RunCmdEnv(env []string, command string, args ...string) (string, string, er return stdout, stderr, nil } -// E2ETestNodePreparer implements testutils.TestNodePreparer interface, which is used -// to create/modify Nodes before running a test. -type E2ETestNodePreparer struct { - client clientset.Interface - // Specifies how many nodes should be modified using the given strategy. - // Only one strategy can be applied to a single Node, so there needs to - // be at least Nodes in the cluster. - countToStrategy []testutils.CountToStrategy - nodeToAppliedStrategy map[string]testutils.PrepareNodeStrategy -} - -// PrepareNodes prepares nodes in the cluster. -func (p *E2ETestNodePreparer) PrepareNodes() error { - nodes, err := e2enode.GetReadySchedulableNodes(p.client) - if err != nil { - return err - } - numTemplates := 0 - for _, v := range p.countToStrategy { - numTemplates += v.Count - } - if numTemplates > len(nodes.Items) { - return fmt.Errorf("Can't prepare Nodes. Got more templates than existing Nodes") - } - index := 0 - sum := 0 - for _, v := range p.countToStrategy { - sum += v.Count - for ; index < sum; index++ { - if err := testutils.DoPrepareNode(p.client, &nodes.Items[index], v.Strategy); err != nil { - klog.Errorf("Aborting node preparation: %v", err) - return err - } - p.nodeToAppliedStrategy[nodes.Items[index].Name] = v.Strategy - } - } - return nil -} - -// CleanupNodes cleanups nodes in the cluster. -func (p *E2ETestNodePreparer) CleanupNodes() error { - var encounteredError error - nodes, err := e2enode.GetReadySchedulableNodes(p.client) - if err != nil { - return err - } - for i := range nodes.Items { - name := nodes.Items[i].Name - strategy, found := p.nodeToAppliedStrategy[name] - if found { - if err = testutils.DoCleanupNode(p.client, name, strategy); err != nil { - klog.Errorf("Skipping cleanup of Node: failed update of %v: %v", name, err) - encounteredError = err - } - } - } - return encounteredError -} - // getMasterAddresses returns the externalIP, internalIP and hostname fields of the master. // If any of these is unavailable, it is set to "". func getMasterAddresses(c clientset.Interface) (string, string, string) {