Skip to content

Commit 8207094

Browse files
authored
chore(provisionerd): close completeChan exactly once (coder#16011)
Fixes coder/internal#263
1 parent 9c62547 commit 8207094

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

provisionerd/provisionerd_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ func TestProvisionerd(t *testing.T) {
7070
close(done)
7171
})
7272
completeChan := make(chan struct{})
73+
var completed sync.Once
7374
closer := createProvisionerd(t, func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error) {
74-
defer close(completeChan)
75+
completed.Do(func() {
76+
defer close(completeChan)
77+
})
7578
return nil, xerrors.New("an error")
7679
}, provisionerd.LocalProvisioners{})
7780
require.Condition(t, closedWithin(completeChan, testutil.WaitShort))

0 commit comments

Comments
 (0)