Skip to content

Commit e5f8b20

Browse files
committed
fix(tests): testscript race condition
1 parent 61ad744 commit e5f8b20

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

testscript/script_test.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,10 @@ func TestScript(t *testing.T) {
134134
be := backend.New(ctx, cfg, dbx)
135135
ctx = backend.WithContext(ctx, be)
136136

137-
// prevent race condition in lipgloss...
138-
// this will probably be autofixed when we start using the colors
139-
// from the ssh session instead of the server.
140-
// XXX: take another look at this soon
141137
lock.Lock()
142138
srv, err := server.NewServer(ctx)
143139
if err != nil {
140+
lock.Unlock()
144141
return err
145142
}
146143
lock.Unlock()
@@ -155,6 +152,8 @@ func TestScript(t *testing.T) {
155152
defer dbx.Close() // nolint: errcheck
156153
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
157154
defer cancel()
155+
lock.Lock()
156+
defer lock.Unlock()
158157
if err := srv.Shutdown(ctx); err != nil {
159158
e.T().Fatal(err)
160159
}

0 commit comments

Comments
 (0)