Skip to content

Commit

Permalink
fix(tests): testscript race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Aug 4, 2023
1 parent 61ad744 commit e5f8b20
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions testscript/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,10 @@ func TestScript(t *testing.T) {
be := backend.New(ctx, cfg, dbx)
ctx = backend.WithContext(ctx, be)

// prevent race condition in lipgloss...
// this will probably be autofixed when we start using the colors
// from the ssh session instead of the server.
// XXX: take another look at this soon
lock.Lock()
srv, err := server.NewServer(ctx)
if err != nil {
lock.Unlock()
return err
}
lock.Unlock()
Expand All @@ -155,6 +152,8 @@ func TestScript(t *testing.T) {
defer dbx.Close() // nolint: errcheck
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
lock.Lock()
defer lock.Unlock()
if err := srv.Shutdown(ctx); err != nil {
e.T().Fatal(err)
}
Expand Down

0 comments on commit e5f8b20

Please sign in to comment.