Replace calls to cs.CoreV1().Nodes().Create() with createNode()

This commit is contained in:
Wei Huang 2020-10-30 13:35:50 -07:00
parent f054765762
commit a146cb0aa0
No known key found for this signature in database
GPG Key ID: BE5E9752F8B6E005
3 changed files with 4 additions and 5 deletions

View File

@ -381,7 +381,7 @@ func DoTestPodScheduling(ns *v1.Namespace, t *testing.T, cs clientset.Interface)
for ii := 0; ii < 5; ii++ { for ii := 0; ii < 5; ii++ {
node.Name = fmt.Sprintf("machine%d", ii+1) node.Name = fmt.Sprintf("machine%d", ii+1)
if _, err := cs.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}); err != nil { if _, err := createNode(cs, node); err != nil {
t.Fatalf("Failed to create nodes: %v", err) t.Fatalf("Failed to create nodes: %v", err)
} }
} }

View File

@ -39,7 +39,6 @@ import (
) )
// This file tests the scheduler priority functions. // This file tests the scheduler priority functions.
func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *testutils.TestContext { func initTestSchedulerForPriorityTest(t *testing.T, scorePluginName string) *testutils.TestContext {
prof := schedulerconfig.KubeSchedulerProfile{ prof := schedulerconfig.KubeSchedulerProfile{
SchedulerName: v1.DefaultSchedulerName, SchedulerName: v1.DefaultSchedulerName,

View File

@ -427,7 +427,7 @@ func TestUnschedulableNodes(t *testing.T) {
} }
for i, mod := range nodeModifications { for i, mod := range nodeModifications {
unSchedNode, err := testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}) unSchedNode, err := createNode(testCtx.ClientSet, node)
if err != nil { if err != nil {
t.Fatalf("Failed to create node: %v", err) t.Fatalf("Failed to create node: %v", err)
} }
@ -510,7 +510,7 @@ func TestMultipleSchedulers(t *testing.T) {
}, },
}, },
} }
testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}) createNode(testCtx.ClientSet, node)
// 3. create 3 pods for testing // 3. create 3 pods for testing
t.Logf("create 3 pods for testing") t.Logf("create 3 pods for testing")
@ -635,7 +635,7 @@ func TestMultipleSchedulingProfiles(t *testing.T) {
}, },
}, },
} }
if _, err := testCtx.ClientSet.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}); err != nil { if _, err := createNode(testCtx.ClientSet, node); err != nil {
t.Fatal(err) t.Fatal(err)
} }