chore(coderd): remove timing check (#7144)

This commit is contained in:
Ammar Bandukwala 2023-04-17 12:40:02 -05:00 committed by GitHub
parent b3b26a62f2
commit 80bf042528
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 19 deletions

View File

@ -1271,18 +1271,6 @@ func TestWorkspaceAgent_Metadata(t *testing.T) {
check := func(want codersdk.WorkspaceAgentMetadataResult, got codersdk.WorkspaceAgentMetadata) {
require.Equal(t, want.Value, got.Result.Value)
require.Equal(t, want.Error, got.Result.Error)
if testutil.InCI() && (runtime.GOOS == "windows" || testutil.InRaceMode()) {
// Avoid testing timings when flake chance is high.
return
}
require.WithinDuration(t, got.Result.CollectedAt, want.CollectedAt, time.Second)
ageImpliedNow := got.Result.CollectedAt.Add(time.Duration(got.Result.Age) * time.Second)
// We use a long WithinDuration to tolerate slow CI, but we're still making sure
// that Age is within the ballpark.
require.WithinDuration(
t, time.Now(), ageImpliedNow, time.Second*10,
)
}
wantMetadata1 := codersdk.WorkspaceAgentMetadataResult{

View File

@ -1,7 +1,6 @@
package testutil
import (
"flag"
"os"
)
@ -9,9 +8,3 @@ func InCI() bool {
_, ok := os.LookupEnv("CI")
return ok
}
func InRaceMode() bool {
fl := flag.Lookup("race")
//nolint:forcetypeassert
return fl != nil && fl.Value.(flag.Getter).Get().(bool)
}