mirror of
https://github.com/coder/coder.git
synced 2025-07-08 11:39:50 +00:00
chore: fix windows postgres tests (#15593)
Patches tests that caused Windows Postgres CI in https://github.com/coder/coder/pull/15520 to consistently fail. I tested this by temporarily adding Postgres Windows CI to this PR. However, I reverted those changes to merge them with https://github.com/coder/coder/pull/15520. For reference, here's [a passing CI run](https://github.com/coder/coder/actions/runs/11918816662/job/33219786238) from an earlier commit. **Note:** Although Windows tests now pass, they remain quite flaky. I recommend running Postgres Windows CI to gather data on these flakes, but I don’t think it should be a required job just yet.
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"net/http/httptest"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@ -168,10 +169,16 @@ func TestRegions(t *testing.T) {
|
||||
require.Equal(t, proxy.Url, regions[1].PathAppURL)
|
||||
require.Equal(t, proxy.WildcardHostname, regions[1].WildcardHostname)
|
||||
|
||||
waitTime := testutil.WaitShort / 10
|
||||
// windows needs more time
|
||||
if runtime.GOOS == "windows" {
|
||||
waitTime = testutil.WaitShort / 5
|
||||
}
|
||||
|
||||
// Unfortunately need to wait to assert createdAt/updatedAt
|
||||
<-time.After(testutil.WaitShort / 10)
|
||||
require.WithinDuration(t, approxCreateTime, proxy.CreatedAt, testutil.WaitShort/10)
|
||||
require.WithinDuration(t, approxCreateTime, proxy.UpdatedAt, testutil.WaitShort/10)
|
||||
<-time.After(waitTime)
|
||||
require.WithinDuration(t, approxCreateTime, proxy.CreatedAt, waitTime)
|
||||
require.WithinDuration(t, approxCreateTime, proxy.UpdatedAt, waitTime)
|
||||
})
|
||||
|
||||
t.Run("RequireAuth", func(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user