Skip to content

Commit d2a608a

Browse files
committed
Merge branch 'main' into colin/tailscale-up-retry
2 parents de1c0f3 + 12f87cb commit d2a608a

File tree

20 files changed

+249
-368
lines changed

20 files changed

+249
-368
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
# Check for any typos!
4343
- name: Check for typos
44-
uses: crate-ci/typos@v1.14.8
44+
uses: crate-ci/typos@v1.14.9
4545
with:
4646
config: .github/workflows/typos.toml
4747
- name: Fix the typos

.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Checkout repository
3939
uses: actions/checkout@v2
4040
- name: Run delete-old-branches-action
41-
uses: beatlabs/delete-old-branches-action@v0.0.9
41+
uses: beatlabs/delete-old-branches-action@v0.0.10
4242
with:
4343
repo_token: ${{ github.token }}
4444
date: "6 months ago"

cli/clitest/clitest.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func Start(t *testing.T, inv *clibase.Invocation) {
137137
// before ours.
138138
waiter := StartWithWaiter(t, inv)
139139
t.Cleanup(func() {
140+
waiter.Cancel()
140141
<-closeCh
141142
})
142143

@@ -163,11 +164,16 @@ func Run(t *testing.T, inv *clibase.Invocation) {
163164
type ErrorWaiter struct {
164165
waitOnce sync.Once
165166
cachedError error
167+
cancelFunc context.CancelFunc
166168

167169
c <-chan error
168170
t *testing.T
169171
}
170172

173+
func (w *ErrorWaiter) Cancel() {
174+
w.cancelFunc()
175+
}
176+
171177
func (w *ErrorWaiter) Wait() error {
172178
w.waitOnce.Do(func() {
173179
var ok bool
@@ -241,5 +247,5 @@ func StartWithWaiter(t *testing.T, inv *clibase.Invocation) *ErrorWaiter {
241247
cleaningUp.Store(true)
242248
<-doneCh
243249
})
244-
return &ErrorWaiter{c: errCh, t: t}
250+
return &ErrorWaiter{c: errCh, t: t, cancelFunc: cancel}
245251
}

cli/gitssh_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ func prepareTestGitSSH(ctx context.Context, t *testing.T) (*codersdk.Client, str
5858

5959
// start workspace agent
6060
inv, root := clitest.New(t, "agent", "--agent-token", agentToken, "--agent-url", client.URL.String())
61-
agentClient := client
61+
agentClient := codersdk.New(client.URL)
62+
agentClient.SetSessionToken(agentToken)
6263
clitest.SetupConfig(t, agentClient, root)
63-
6464
clitest.Start(t, inv)
6565

6666
coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)

cli/server_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ func TestServer(t *testing.T) {
121121
)
122122

123123
const superDuperLong = testutil.WaitSuperLong * 3
124-
125124
ctx := testutil.Context(t, superDuperLong)
126125
clitest.Start(t, inv.WithContext(ctx))
127126

@@ -1430,6 +1429,7 @@ func TestServer(t *testing.T) {
14301429
wantConfig.Options[i].Name,
14311430
)
14321431
}
1432+
w.Cancel()
14331433
w.RequireSuccess()
14341434
})
14351435
})
@@ -1460,8 +1460,8 @@ func TestServer(t *testing.T) {
14601460
})
14611461
}
14621462

1463-
//nolint:tparallel,paralleltest // This test spawns or connects to an existing PostgreSQL instance.
14641463
func TestServer_Production(t *testing.T) {
1464+
t.Parallel()
14651465
if runtime.GOOS != "linux" || testing.Short() {
14661466
// Skip on non-Linux because it spawns a PostgreSQL instance.
14671467
t.SkipNow()
@@ -1471,7 +1471,8 @@ func TestServer_Production(t *testing.T) {
14711471
defer closeFunc()
14721472

14731473
// Postgres + race detector + CI = slow.
1474-
ctx := testutil.Context(t, testutil.WaitSuperLong*3)
1474+
ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitSuperLong*3)
1475+
defer cancelFunc()
14751476

14761477
inv, cfg := clitest.New(t,
14771478
"server",

cli/vscodessh_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func TestVSCodeSSH(t *testing.T) {
6868
}
6969
return len(entries) > 0
7070
}, testutil.WaitLong, testutil.IntervalFast)
71+
waiter.Cancel()
7172

7273
if err := waiter.Wait(); err != nil {
7374
waiter.RequireIs(context.Canceled)

docs/contributing/frontend.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,31 @@ user.click(screen.getByRole("button"))
166166
const form = screen.getByTestId("form")
167167
user.click(within(form).getByRole("button"))
168168
```
169+
170+
#### `jest.spyOn` with the API is not working
171+
172+
For some unknown reason, we figured out the `jest.spyOn` is not able to mock the API function when they are passed directly into the services XState machine configuration.
173+
174+
❌ Does not work
175+
176+
```ts
177+
import { getUpdateCheck } from "api/api"
178+
179+
createMachine({ ... }, {
180+
services: {
181+
getUpdateCheck,
182+
},
183+
})
184+
```
185+
186+
✅ It works
187+
188+
```ts
189+
import { getUpdateCheck } from "api/api"
190+
191+
createMachine({ ... }, {
192+
services: {
193+
getUpdateCheck: () => getUpdateCheck(),
194+
},
195+
})
196+
```

enterprise/coderd/workspaceproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import (
3131
// forceWorkspaceProxyHealthUpdate forces an update of the proxy health.
3232
// This is useful when a proxy is created or deleted. Errors will be logged.
3333
func (api *API) forceWorkspaceProxyHealthUpdate(ctx context.Context) {
34-
if err := api.ProxyHealth.ForceUpdate(ctx); err != nil {
34+
if err := api.ProxyHealth.ForceUpdate(ctx); err != nil && !xerrors.Is(err, context.Canceled) {
3535
api.Logger.Error(ctx, "force proxy health update", slog.Error(err))
3636
}
3737
}

go.mod

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ require (
8181
github.com/coder/retry v1.3.1-0.20230210155434-e90a2e1e091d
8282
github.com/coder/terraform-provider-coder v0.6.23
8383
github.com/coder/wgtunnel v0.1.5
84-
github.com/coreos/go-oidc/v3 v3.4.0
84+
github.com/coreos/go-oidc/v3 v3.6.0
8585
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf
8686
github.com/creack/pty v1.1.18
8787
github.com/elastic/go-sysinfo v1.9.0
@@ -102,7 +102,7 @@ require (
102102
github.com/go-ping/ping v1.1.0
103103
github.com/go-playground/validator/v10 v10.12.0
104104
github.com/gofrs/flock v0.8.1
105-
github.com/gohugoio/hugo v0.110.0
105+
github.com/gohugoio/hugo v0.111.3
106106
github.com/golang-jwt/jwt v3.2.2+incompatible
107107
github.com/golang-jwt/jwt/v4 v4.5.0
108108
github.com/golang-migrate/migrate/v4 v4.15.2
@@ -164,14 +164,14 @@ require (
164164
golang.org/x/crypto v0.8.0
165165
golang.org/x/exp v0.0.0-20221205204356-47842c84f3db
166166
golang.org/x/mod v0.10.0
167-
golang.org/x/oauth2 v0.5.0
167+
golang.org/x/oauth2 v0.6.0
168168
golang.org/x/sync v0.1.0
169169
golang.org/x/sys v0.8.0
170170
golang.org/x/term v0.7.0
171171
golang.org/x/tools v0.7.0
172172
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
173173
golang.zx2c4.com/wireguard v0.0.0-20230325221338-052af4a8072b
174-
google.golang.org/api v0.108.0
174+
google.golang.org/api v0.110.0
175175
google.golang.org/grpc v1.54.0
176176
google.golang.org/protobuf v1.30.0
177177
gopkg.in/natefinch/lumberjack.v2 v2.2.1
@@ -257,7 +257,7 @@ require (
257257
github.com/google/go-cmp v0.5.9 // indirect
258258
github.com/google/go-querystring v1.1.0 // indirect
259259
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
260-
github.com/googleapis/enterprise-certificate-proxy v0.2.1 // indirect
260+
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
261261
github.com/gorilla/css v1.0.0 // indirect
262262
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.1 // indirect
263263
github.com/h2non/filetype v1.1.3 // indirect
@@ -308,7 +308,7 @@ require (
308308
github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a // indirect
309309
github.com/muesli/cancelreader v0.2.2 // indirect
310310
github.com/muesli/termenv v0.15.1
311-
github.com/niklasfasching/go-org v1.6.5 // indirect
311+
github.com/niklasfasching/go-org v1.6.6 // indirect
312312
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
313313
github.com/olekukonko/tablewriter v0.0.5 // indirect
314314
github.com/opencontainers/go-digest v1.0.0 // indirect
@@ -334,7 +334,7 @@ require (
334334
github.com/tailscale/wireguard-go v0.0.0-20230410165232-af172621b4dd // indirect
335335
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
336336
github.com/tcnksm/go-httpstat v0.2.0 // indirect
337-
github.com/tdewolff/parse/v2 v2.6.4 // indirect
337+
github.com/tdewolff/parse/v2 v2.6.5 // indirect
338338
github.com/u-root/uio v0.0.0-20221213070652-c3537552635f // indirect
339339
github.com/vishvananda/netlink v1.1.1-0.20211118161826-650dca95af54 // indirect
340340
github.com/vishvananda/netns v0.0.0-20211101163701-50045581ed74 // indirect
@@ -347,7 +347,7 @@ require (
347347
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
348348
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
349349
github.com/yashtewari/glob-intersection v0.1.0 // indirect
350-
github.com/yuin/goldmark v1.5.3 // indirect
350+
github.com/yuin/goldmark v1.5.4 // indirect
351351
github.com/yuin/goldmark-emoji v1.0.1 // indirect
352352
github.com/zclconf/go-cty v1.10.0 // indirect
353353
github.com/zeebo/errs v1.3.0 // indirect
@@ -364,7 +364,6 @@ require (
364364
golang.zx2c4.com/wireguard/windows v0.5.3 // indirect
365365
google.golang.org/appengine v1.6.7 // indirect
366366
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923 // indirect
367-
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
368367
gopkg.in/yaml.v2 v2.4.0 // indirect
369368
howett.net/plist v1.0.0 // indirect
370369
inet.af/peercred v0.0.0-20210906144145-0893ea02156a // indirect

0 commit comments

Comments
 (0)