From 33a7e94b6ac2a5e8466be0d02a2e41216b4e7c27 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Wed, 29 Jul 2020 08:00:55 +0800 Subject: [PATCH] Create new slices to avoid modify original fake data When create fake data for the nodeTree unittests, The 'append' is invoked on the common fake data set. That makes the unittests is running with unexpected fake data after that. --- pkg/scheduler/internal/cache/node_tree_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/scheduler/internal/cache/node_tree_test.go b/pkg/scheduler/internal/cache/node_tree_test.go index 34d2d3af2e8e7..087187296f1d9 100644 --- a/pkg/scheduler/internal/cache/node_tree_test.go +++ b/pkg/scheduler/internal/cache/node_tree_test.go @@ -428,14 +428,14 @@ func TestNodeTreeMultiOperations(t *testing.T) { }, { name: "add more nodes to an exhausted zone", - nodesToAdd: append(allNodes[4:9], allNodes[3]), + nodesToAdd: append(allNodes[4:9:9], allNodes[3]), nodesToRemove: nil, operations: []string{"add", "add", "add", "add", "add", "next", "next", "next", "next", "add", "next", "next", "next"}, - expectedOutput: []string{"node-4", "node-6", "node-7", "node-8", "node-3", "node-4", "node-6"}, + expectedOutput: []string{"node-4", "node-5", "node-6", "node-7", "node-3", "node-8", "node-4"}, }, { name: "remove zone and add new to ensure exhausted is reset correctly", - nodesToAdd: append(allNodes[3:5], allNodes[6:8]...), + nodesToAdd: append(allNodes[3:5:5], allNodes[6:8]...), nodesToRemove: allNodes[3:5], operations: []string{"add", "add", "next", "next", "remove", "add", "add", "next", "next", "remove", "next", "next"}, expectedOutput: []string{"node-3", "node-4", "node-6", "node-7", "node-6", "node-7"},