Skip to content

Commit

Permalink
fix: Fix idle duration timeout for pod/node batcher (#1244)
Browse files Browse the repository at this point in the history
Co-authored-by: jigisha620 <[email protected]>
  • Loading branch information
jonathan-innis and jigisha620 authored Dec 12, 2024
1 parent 1b00cf5 commit 83332db
Show file tree
Hide file tree
Showing 9 changed files with 219 additions and 83 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ deflake: ## Run randomized, racing tests until the test fails to catch flakes
ginkgo \
--race \
--focus="${FOCUS}" \
--timeout=10m \
--timeout=20m \
--randomize-all \
--until-it-fails \
-v \
Expand Down
66 changes: 33 additions & 33 deletions pkg/controllers/disruption/consolidation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, []*corev1.Node{node}, []*v1.NodeClaim{nodeClaim})

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -205,7 +205,7 @@ var _ = Describe("Consolidation", func() {

fakeClock.Step(10 * time.Minute)
wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -254,7 +254,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)

ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand All @@ -280,7 +280,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)

ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -353,7 +353,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -398,7 +398,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
// Reconcile 5 times, enqueuing 3 commands total.
for i := 0; i < 5; i++ {
ExpectSingletonReconciled(ctx, disruptionController)
Expand Down Expand Up @@ -462,7 +462,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -528,7 +528,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -901,7 +901,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1197,7 +1197,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1322,7 +1322,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1447,7 +1447,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1615,7 +1615,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1767,7 +1767,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1841,7 +1841,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old node until the new node is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -1936,7 +1936,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -2027,7 +2027,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -2285,7 +2285,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2332,7 +2332,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2386,7 +2386,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2448,7 +2448,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2500,7 +2500,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2548,7 +2548,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2694,7 +2694,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2884,7 +2884,7 @@ var _ = Describe("Consolidation", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, []*corev1.Node{consolidatableNode}, []*v1.NodeClaim{consolidatableNodeClaim})

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -2940,7 +2940,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -3052,7 +3052,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -3575,7 +3575,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -3639,7 +3639,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -3712,7 +3712,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -4046,7 +4046,7 @@ var _ = Describe("Consolidation", func() {
fakeClock.SetTime(time.Now())

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -4158,7 +4158,7 @@ var _ = Describe("Consolidation", func() {

// consolidation won't delete the old node until the new node is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()
Expand Down Expand Up @@ -4290,7 +4290,7 @@ var _ = Describe("Consolidation", func() {
// Run the processing loop in parallel in the background with environment context
var wg sync.WaitGroup
ExpectMakeNewNodeClaimsReady(ctx, env.Client, &wg, cluster, cloudProvider, 1)
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
go func() {
defer GinkgoRecover()
ExpectSingletonReconciled(ctx, disruptionController)
Expand Down
18 changes: 9 additions & 9 deletions pkg/controllers/disruption/emptiness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var _ = Describe("Emptiness", func() {

fakeClock.Step(10 * time.Minute)
wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -147,7 +147,7 @@ var _ = Describe("Emptiness", func() {

// consolidation won't delete the old nodeclaim until the new nodeclaim is ready
var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -235,7 +235,7 @@ var _ = Describe("Emptiness", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -303,7 +303,7 @@ var _ = Describe("Emptiness", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -372,7 +372,7 @@ var _ = Describe("Emptiness", func() {
ExpectMakeNodesAndNodeClaimsInitializedAndStateUpdated(ctx, env.Client, nodeStateController, nodeClaimStateController, nodes, nodeClaims)

wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand All @@ -398,7 +398,7 @@ var _ = Describe("Emptiness", func() {

fakeClock.Step(10 * time.Minute)
wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -479,7 +479,7 @@ var _ = Describe("Emptiness", func() {
fakeClock.Step(10 * time.Minute)

wg := sync.WaitGroup{}
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -594,7 +594,7 @@ var _ = Describe("Emptiness", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down Expand Up @@ -659,7 +659,7 @@ var _ = Describe("Emptiness", func() {
fakeClock.Step(10 * time.Minute)

var wg sync.WaitGroup
ExpectToWait(&wg)
ExpectToWait(fakeClock, &wg)
ExpectSingletonReconciled(ctx, disruptionController)
wg.Wait()

Expand Down
Loading

0 comments on commit 83332db

Please sign in to comment.