Skip to content

Commit 53ba2ce

Browse files
authored
Merge pull request kubernetes#90865 from Huang-Wei/dedicated-informfactory-node-controller
test: Use dedicated informerFactory for node lifecycle controller
2 parents 34226de + fc11871 commit 53ba2ce

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

test/integration/node/lifecycle_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,17 @@ func TestTaintBasedEvictions(t *testing.T) {
134134
testCtx = testutils.InitTestScheduler(t, testCtx, true, nil)
135135
defer testutils.CleanupTest(t, testCtx)
136136
cs := testCtx.ClientSet
137-
informers := testCtx.InformerFactory
138137
_, err := cs.CoreV1().Namespaces().Create(context.TODO(), testCtx.NS, metav1.CreateOptions{})
139138
if err != nil {
140139
t.Errorf("Failed to create namespace %+v", err)
141140
}
142141

143142
// Start NodeLifecycleController for taint.
144143
nc, err := nodelifecycle.NewNodeLifecycleController(
145-
informers.Coordination().V1().Leases(),
146-
informers.Core().V1().Pods(),
147-
informers.Core().V1().Nodes(),
148-
informers.Apps().V1().DaemonSets(),
144+
externalInformers.Coordination().V1().Leases(),
145+
externalInformers.Core().V1().Pods(),
146+
externalInformers.Core().V1().Nodes(),
147+
externalInformers.Apps().V1().DaemonSets(),
149148
cs,
150149
5*time.Second, // Node monitor grace period
151150
time.Minute, // Node startup grace period
@@ -167,8 +166,8 @@ func TestTaintBasedEvictions(t *testing.T) {
167166
// Waiting for all controller sync.
168167
externalInformers.Start(testCtx.Ctx.Done())
169168
externalInformers.WaitForCacheSync(testCtx.Ctx.Done())
170-
informers.Start(testCtx.Ctx.Done())
171-
informers.WaitForCacheSync(testCtx.Ctx.Done())
169+
testCtx.InformerFactory.Start(testCtx.Ctx.Done())
170+
testCtx.InformerFactory.WaitForCacheSync(testCtx.Ctx.Done())
172171

173172
nodeRes := v1.ResourceList{
174173
v1.ResourceCPU: resource.MustParse("4000m"),

test/integration/scheduler/taint_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,14 @@ func TestTaintNodeByCondition(t *testing.T) {
7979
defer testutils.CleanupTest(t, testCtx)
8080

8181
cs := testCtx.ClientSet
82-
informers := testCtx.InformerFactory
8382
nsName := testCtx.NS.Name
8483

8584
// Start NodeLifecycleController for taint.
8685
nc, err := nodelifecycle.NewNodeLifecycleController(
87-
informers.Coordination().V1().Leases(),
88-
informers.Core().V1().Pods(),
89-
informers.Core().V1().Nodes(),
90-
informers.Apps().V1().DaemonSets(),
86+
externalInformers.Coordination().V1().Leases(),
87+
externalInformers.Core().V1().Pods(),
88+
externalInformers.Core().V1().Nodes(),
89+
externalInformers.Apps().V1().DaemonSets(),
9190
cs,
9291
time.Hour, // Node monitor grace period
9392
time.Second, // Node startup grace period
@@ -108,8 +107,8 @@ func TestTaintNodeByCondition(t *testing.T) {
108107
// Waiting for all controller sync.
109108
externalInformers.Start(testCtx.Ctx.Done())
110109
externalInformers.WaitForCacheSync(testCtx.Ctx.Done())
111-
informers.Start(testCtx.Ctx.Done())
112-
informers.WaitForCacheSync(testCtx.Ctx.Done())
110+
testCtx.InformerFactory.Start(testCtx.Ctx.Done())
111+
testCtx.InformerFactory.WaitForCacheSync(testCtx.Ctx.Done())
113112

114113
// -------------------------------------------
115114
// Test TaintNodeByCondition feature.

0 commit comments

Comments
 (0)