Skip to content

Commit

Permalink
Add logging for ConsolidationState test flake
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Feb 3, 2025
1 parent 6431d04 commit ecb3dff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ deflake: ## Run randomized, racing tests until the test fails to catch flakes
--randomize-all \
--until-it-fails \
-v \
./pkg/...
./pkg/controllers/state/...

vulncheck: ## Verify code vulnerabilities
@govulncheck ./pkg/...
Expand Down
16 changes: 12 additions & 4 deletions pkg/controllers/state/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1474,17 +1474,25 @@ var _ = Describe("Consolidated State", func() {
cluster.MarkUnconsolidated()
Expect(cluster.ConsolidationState()).ToNot(Equal(state))
})
It("should update the consolidated value when consolidation timeout (5m) has passed and state hasn't changed", func() {
It("should update the consolidated value when state timeout (5m) has passed and state hasn't changed", func() {
fmt.Println(fakeClock.Now())
state := cluster.ConsolidationState()
fmt.Printf("Initial state: %v\n", state)

fakeClock.Step(time.Minute)
Expect(cluster.ConsolidationState()).To(Equal(state))
initial := cluster.ConsolidationState()
fmt.Printf("After moving a minute: %v\n", initial)
Expect(initial).To(Equal(state))

fakeClock.Step(time.Minute * 2)
Expect(cluster.ConsolidationState()).To(Equal(state))
initial2 := cluster.ConsolidationState()
fmt.Printf("After moving two minutes: %v\n", initial2)
Expect(initial2).To(Equal(state))

fakeClock.Step(time.Minute * 2)
Expect(cluster.ConsolidationState()).ToNot(Equal(state))
initial3 := cluster.ConsolidationState()
fmt.Printf("After moving two more minutes: %v\n", initial3)
Expect(initial3).ToNot(Equal(state))
})
It("should cause consolidation state to change when a NodePool is updated", func() {
cluster.MarkUnconsolidated()
Expand Down

0 comments on commit ecb3dff

Please sign in to comment.