Skip to content

Commit

Permalink
fix(cd-service): fix flaky datadog gauge test (#2159)
Browse files Browse the repository at this point in the history
Ref: SRX-PXQRS5
lastDeployed is a float time difference. It can be anywhere between 0
and 1. For us if it's less than 1 minute is enough.
  • Loading branch information
AminSlk authored Dec 3, 2024
1 parent 785be22 commit 3f941d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions services/cd-service/pkg/repository/transformer_db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4147,6 +4147,11 @@ func TestUpdateDatadogMetricsInternal(t *testing.T) {
sort.Strings(actualGauge.Tags)
t.Logf("actualGauges:[%v] %v:%v", i, actualGauge.Name, actualGauge.Tags)
t.Logf("expectedGauges:[%v] %v:%v", i, expectedGauge.Name, expectedGauge.Tags)
if actualGauge.Name == "lastDeployed" {
if actualGauge.Value < 1 {
actualGauge.Value = 0
}
}

if diff := cmp.Diff(expectedGauge, actualGauge, cmpopts.IgnoreFields(statsd.Event{}, "Timestamp")); diff != "" {
t.Errorf("[%d] want %v, got %v, diff (-want +got) %s", i, expectedGauge, actualGauge, diff)
Expand Down

0 comments on commit 3f941d1

Please sign in to comment.