provisioner/windows-restart: remove race in test
This commit is contained in:
parent
f401e765df
commit
1aad5cf6d5
|
@ -193,12 +193,14 @@ func TestProvision_waitForRestartTimeout(t *testing.T) {
|
||||||
p.Prepare(config)
|
p.Prepare(config)
|
||||||
waitForCommunicatorOld := waitForCommunicator
|
waitForCommunicatorOld := waitForCommunicator
|
||||||
waitDone := make(chan bool)
|
waitDone := make(chan bool)
|
||||||
|
waitContinue := make(chan bool)
|
||||||
|
|
||||||
// Block until cancel comes through
|
// Block until cancel comes through
|
||||||
waitForCommunicator = func(p *Provisioner) error {
|
waitForCommunicator = func(p *Provisioner) error {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-waitDone:
|
case <-waitDone:
|
||||||
|
waitContinue <- true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -207,7 +209,7 @@ func TestProvision_waitForRestartTimeout(t *testing.T) {
|
||||||
err = p.Provision(ui, comm)
|
err = p.Provision(ui, comm)
|
||||||
waitDone <- true
|
waitDone <- true
|
||||||
}()
|
}()
|
||||||
<-waitDone
|
<-waitContinue
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("should not have error")
|
t.Fatal("should not have error")
|
||||||
|
|
Loading…
Reference in New Issue