Skip to content

Commit ca97188

Browse files
committed
fix test asserts
1 parent 32a30ff commit ca97188

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

provisioner/terraform/timings_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import (
66
"context"
77
"os"
88
"path/filepath"
9+
"strings"
910
"testing"
1011

1112
"github.com/stretchr/testify/require"
1213

1314
"github.com/coder/coder/v2/coderd/database"
15+
"github.com/coder/coder/v2/coderd/util/slice"
1416
terraform_internal "github.com/coder/coder/v2/provisioner/terraform/internal"
1517
"github.com/coder/coder/v2/provisionersdk/proto"
1618
"github.com/coder/coder/v2/testutil"
@@ -95,6 +97,12 @@ func TestTimingsFromProvision(t *testing.T) {
9597

9698
// Sort the timings stably to keep reduce flakiness.
9799
terraform_internal.StableSortTimings(t, timings)
100+
// `coder_stage_` timings use `dbtime.Now()`, which makes them hard to compare to
101+
// a static set of expected timings. Filter them out. This test is good for
102+
// testing timings sourced from terraform logs, not internal coder timings.
103+
timings = slice.Filter(timings, func(tim *proto.Timing) bool {
104+
return !strings.HasPrefix(tim.Resource, "coder_stage_")
105+
})
98106

99107
// Then: the received timings should match the expected values below.
100108
// NOTE: These timings have been encoded to JSON format to make the tests more readable.

0 commit comments

Comments
 (0)