Skip to content

Commit 0fc20aa

Browse files
dd-octo-sts[bot]AliDatadogfrank-spano
authored
[Backport 7.72.x] update test that was flakey on windows (#42098)
Backport 8310fe0 from #42005. ___ ### What does this PR do? Fixes flakey deployment test on windows ### Motivation ``` === Failed === FAIL: pkg/collector/corechecks/cluster/ksm/customresources TestDeploymentRolloutGeneration_OngoingRollout (0.00s) deployment_test.go:101: Error Trace: C:/buildroot/datadog-agent/pkg/collector/corechecks/cluster/ksm/customresources/deployment_test.go:101 Error: &quot;0&quot; is not greater than &quot;0&quot; Test: TestDeploymentRolloutGeneration_OngoingRollout Messages: Rollout duration should be greater than 0 for ongoing rollout === FAIL: pkg/collector/corechecks/cluster/ksm/customresources TestDeploymentRolloutGeneration_OngoingRollout (re-run 1) (0.00s) deployment_test.go:101: Error Trace: C:/buildroot/datadog-agent/pkg/collector/corechecks/cluster/ksm/customresources/deployment_test.go:101 Error: &quot;0&quot; is not greater than &quot;0&quot; Test: TestDeploymentRolloutGeneration_OngoingRollout Messages: Rollout duration should be greater than 0 for ongoing rollout === FAIL: pkg/collector/corechecks/cluster/ksm/customresources TestDeploymentRolloutGeneration_OngoingRollout (re-run 2) (0.00s) deployment_test.go:101: Error Trace: C:/buildroot/datadog-agent/pkg/collector/corechecks/cluster/ksm/customresources/deployment_test.go:101 Error: &quot;0&quot; is not greater than &quot;0&quot; Test: TestDeploymentRolloutGeneration_OngoingRollout Messages: Rollout duration should be greater than 0 for ongoing rollout ``` ### Describe how you validated your changes ### Additional Notes Co-authored-by: AliDatadog <[email protected]> Co-authored-by: frank-spano <[email protected]> Co-authored-by: ali.benabdallah <[email protected]>
1 parent 50420bb commit 0fc20aa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/collector/corechecks/cluster/ksm/customresources/deployment_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ package customresources
99

1010
import (
1111
"testing"
12+
"time"
1213

1314
"github.com/stretchr/testify/assert"
1415
"github.com/stretchr/testify/require"
@@ -97,8 +98,11 @@ func TestDeploymentRolloutGeneration_OngoingRollout(t *testing.T) {
9798
assert.Equal(t, []string{"default", "test-deployment"}, metric.LabelValues)
9899

99100
// Verify deployment was stored in tracker (indirectly by checking if rollout duration can be retrieved)
100-
duration := tracker.GetRolloutDuration("default", "test-deployment")
101-
assert.Greater(t, duration, 0.0, "Rollout duration should be greater than 0 for ongoing rollout")
101+
assert.EventuallyWithT(t, func(t *assert.CollectT) {
102+
duration := tracker.GetRolloutDuration("default", "test-deployment")
103+
assert.Greater(t, duration, 0.0, "Rollout duration should be greater than 0 for ongoing rollout")
104+
}, 5*time.Second, 100*time.Millisecond)
105+
102106
}
103107

104108
func TestDeploymentRolloutGeneration_CompletedRollout(t *testing.T) {

0 commit comments

Comments
 (0)