mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore(provisionerd): close completeChan exactly once (#16011)
Fixes https://github.com/coder/internal/issues/263
This commit is contained in:
@@ -70,8 +70,11 @@ func TestProvisionerd(t *testing.T) {
|
||||
close(done)
|
||||
})
|
||||
completeChan := make(chan struct{})
|
||||
var completed sync.Once
|
||||
closer := createProvisionerd(t, func(ctx context.Context) (proto.DRPCProvisionerDaemonClient, error) {
|
||||
defer close(completeChan)
|
||||
completed.Do(func() {
|
||||
defer close(completeChan)
|
||||
})
|
||||
return nil, xerrors.New("an error")
|
||||
}, provisionerd.LocalProvisioners{})
|
||||
require.Condition(t, closedWithin(completeChan, testutil.WaitShort))
|
||||
|
||||
Reference in New Issue
Block a user