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

[clusteragent/autoscaling] Fix flaky DCA target test #29816

Merged
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
11 changes: 7 additions & 4 deletions pkg/clusteragent/autoscaling/workload/controller_test.go
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,16 @@ func TestDatadogPodAutoscalerTargetingClusterAgentErrors(t *testing.T) {
Owner: datadoghq.DatadogPodAutoscalerLocalOwner,
}

// Create object in store
dpa, dpaTyped := newFakePodAutoscaler(currentNs, "dpa-dca", 1, testTime, dpaSpec, datadoghq.DatadogPodAutoscalerStatus{})
f.InformerObjects = append(f.InformerObjects, dpa)
f.Objects = append(f.Objects, dpaTyped)

f.RunControllerSync(true, id)
_, found := f.store.Get(id)
assert.True(t, found)

// Test that object gets updated with correct error status
expectedDPAError := &datadoghq.DatadogPodAutoscaler{
TypeMeta: metav1.TypeMeta{
Kind: "DatadogPodAutoscaler",
Expand Down Expand Up @@ -347,10 +354,6 @@ func TestDatadogPodAutoscalerTargetingClusterAgentErrors(t *testing.T) {
}
expectedUnstructuredError, err := autoscaling.ToUnstructured(expectedDPAError)
assert.NoError(t, err)
f.RunControllerSync(true, id)

f.Objects = append(f.Objects, dpaTyped)
f.Actions = nil

f.ExpectUpdateStatusAction(expectedUnstructuredError)
f.RunControllerSync(true, id)
Expand Down
Loading