mirror of https://github.com/coder/coder.git
chore(coderd): remove timing check (#7144)
This commit is contained in:
parent
b3b26a62f2
commit
80bf042528
|
@ -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{
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue