Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd3d0410

Browse files
committed
test(cli/ssh): sync post-build to fix build race on slow runners
Fixescoder/internal#269
1 parentf4994ca commitd3d0410

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎cli/ssh_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,18 @@ func TestSSH(t *testing.T) {
154154
// a start build of the workspace.
155155
isFirstBuild:=true
156156
buildURL:=regexp.MustCompile("/api/v2/workspaces/.*/builds")
157-
buildReq:=make(chanstruct{})
157+
buildSync:=make(chanstruct{})
158158
buildResume:=make(chanstruct{})
159159
buildSyncMW:=func(next http.Handler) http.Handler {
160160
returnhttp.HandlerFunc(func(w http.ResponseWriter,r*http.Request) {
161161
ifr.Method==http.MethodPost&&buildURL.MatchString(r.URL.Path) {
162162
if!isFirstBuild {
163-
t.Log("buildSyncMW: blocking build")
164-
buildReq<-struct{}{}
165-
<-buildResume
166-
t.Log("buildSyncMW: resuming build")
163+
deferfunc() {
164+
t.Log("buildSyncMW: blocking post-build")
165+
buildSync<-struct{}{}
166+
<-buildResume
167+
t.Log("buildSyncMW: resuming...")
168+
}()
167169
}else {
168170
isFirstBuild=false
169171
}
@@ -212,7 +214,7 @@ func TestSSH(t *testing.T) {
212214
pty.ExpectMatchContext(ctx,"Workspace was stopped, starting workspace to allow connecting to")
213215
}
214216
forrangeptys {
215-
testutil.RequireRecvCtx(ctx,t,buildReq)
217+
testutil.RequireRecvCtx(ctx,t,buildSync)
216218
}
217219
close(buildResume)
218220

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp