Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove the expect enqueued for eviction tests #1469

Merged
merged 1 commit into from
Mar 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions pkg/controllers/termination/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ var _ = Describe("Termination", func() {
node = ExpectNodeExists(ctx, env.Client, node.Name)
ExpectReconcileSucceeded(ctx, controller, client.ObjectKeyFromObject(node))

// Expect podEvict to be enqueued for eviction
ExpectEnqueuedForEviction(evictionQueue, podEvict)

// Expect node to exist and be draining
ExpectNodeDraining(env.Client, node.Name)

Expand Down Expand Up @@ -150,7 +147,6 @@ var _ = Describe("Termination", func() {
ExpectReconcileSucceeded(ctx, controller, client.ObjectKeyFromObject(node))

// Expect podEvict to be enqueued for eviction then be successful
ExpectEnqueuedForEviction(evictionQueue, podEvict)
ExpectEvicted(env.Client, podEvict)

// Delete pod to simulate successful eviction
Expand Down Expand Up @@ -215,9 +211,6 @@ var _ = Describe("Termination", func() {
node = ExpectNodeExists(ctx, env.Client, node.Name)
ExpectReconcileSucceeded(ctx, controller, client.ObjectKeyFromObject(node))

// Expect the pod to be enqueued for eviction
ExpectEnqueuedForEviction(evictionQueue, podNoEvict)

// Expect node to exist and be draining
ExpectNodeDraining(env.Client, node.Name)

Expand Down Expand Up @@ -247,9 +240,6 @@ var _ = Describe("Termination", func() {
node = ExpectNodeExists(ctx, env.Client, node.Name)
ExpectReconcileSucceeded(ctx, controller, client.ObjectKeyFromObject(node))

// Expect podEvict to be enqueued for eviction
ExpectEnqueuedForEviction(evictionQueue, podEvict)

// Expect node to exist and be draining
ExpectNodeDraining(env.Client, node.Name)

Expand Down Expand Up @@ -296,7 +286,6 @@ var _ = Describe("Termination", func() {
ExpectNotEnqueuedForEviction(evictionQueue, podNoEvict)

// Expect podEvict to be enqueued for eviction then be successful
ExpectEnqueuedForEviction(evictionQueue, podEvict)
ExpectEvicted(env.Client, podEvict)

// Expect node to exist and be draining
Expand Down Expand Up @@ -324,8 +313,8 @@ var _ = Describe("Termination", func() {
node = ExpectNodeExists(ctx, env.Client, node.Name)
ExpectReconcileSucceeded(ctx, controller, client.ObjectKeyFromObject(node))

// Expect the pod to be enqueued for eviction
ExpectEnqueuedForEviction(evictionQueue, pods[0], pods[1])
// Expect the pods to be evicted
ExpectEvicted(env.Client, pods[0], pods[1])

// Expect node to exist and be draining, but not deleted
node = ExpectNodeExists(ctx, env.Client, node.Name)
Expand Down Expand Up @@ -364,12 +353,6 @@ var _ = Describe("Termination", func() {
})
})

func ExpectEnqueuedForEviction(e *termination.EvictionQueue, pods ...*v1.Pod) {
for _, pod := range pods {
Expect(e.Contains(client.ObjectKeyFromObject(pod))).To(BeTrue())
}
}

func ExpectNotEnqueuedForEviction(e *termination.EvictionQueue, pods ...*v1.Pod) {
for _, pod := range pods {
Expect(e.Contains(client.ObjectKeyFromObject(pod))).To(BeFalse())
Expand Down