File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -154,16 +154,18 @@ func TestSSH(t *testing.T) {
154
154
// a start build of the workspace.
155
155
isFirstBuild := true
156
156
buildURL := regexp .MustCompile ("/api/v2/workspaces/.*/builds" )
157
- buildReq := make (chan struct {})
157
+ buildSync := make (chan struct {})
158
158
buildResume := make (chan struct {})
159
159
buildSyncMW := func (next http.Handler ) http.Handler {
160
160
return http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
161
161
if r .Method == http .MethodPost && buildURL .MatchString (r .URL .Path ) {
162
162
if ! isFirstBuild {
163
- t .Log ("buildSyncMW: blocking build" )
164
- buildReq <- struct {}{}
165
- <- buildResume
166
- t .Log ("buildSyncMW: resuming build" )
163
+ defer func () {
164
+ t .Log ("buildSyncMW: blocking post-build" )
165
+ buildSync <- struct {}{}
166
+ <- buildResume
167
+ t .Log ("buildSyncMW: resuming..." )
168
+ }()
167
169
} else {
168
170
isFirstBuild = false
169
171
}
@@ -212,7 +214,7 @@ func TestSSH(t *testing.T) {
212
214
pty .ExpectMatchContext (ctx , "Workspace was stopped, starting workspace to allow connecting to" )
213
215
}
214
216
for range ptys {
215
- testutil .RequireRecvCtx (ctx , t , buildReq )
217
+ testutil .RequireRecvCtx (ctx , t , buildSync )
216
218
}
217
219
close (buildResume )
218
220
You can’t perform that action at this time.
0 commit comments