Skip to content

Commit

Permalink
fix(client): unflake Marker List test (#459)
Browse files Browse the repository at this point in the history
The embedded client's Marker `List` test failed in last evening's CI run
([link](https://github.com/honeycombio/terraform-provider-honeycombio/actions/runs/8608401219/job/23590728118)).

We had a similar issue with Marker Settings `List` (#420) and a similar
treatment fixed it up.
  • Loading branch information
jharley authored Apr 9, 2024
1 parent 6b168f6 commit ba90ee7
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions client/marker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package client_test
import (
"context"
"fmt"
"slices"
"testing"
"time"

Expand Down Expand Up @@ -43,10 +44,19 @@ func TestMarkers(t *testing.T) {
})

t.Run("List", func(t *testing.T) {
markers, err := c.Markers.List(ctx, dataset)

require.NoError(t, err)
assert.Contains(t, markers, *m, "could not find newly created marker with List")
// this has proven to be a bit racey after the create above, so we'll retry a few times
assert.EventuallyWithT(t, func(col *assert.CollectT) {
ml, err := c.Markers.List(ctx, dataset)
require.NoError(col, err)

// not doing an Equal here because the timestamps may be different
// and confirming the ID is in the listing is sufficient
assert.Condition(col, func() bool {
return slices.ContainsFunc(ml, func(cm client.Marker) bool {
return cm.ID == m.ID
})
})
}, time.Second, 200*time.Millisecond, "could not find newly created Marker in List")
})

t.Run("Get", func(t *testing.T) {
Expand Down

0 comments on commit ba90ee7

Please sign in to comment.