provisioner/windows-restart: make test pass on slow machines

This commit is contained in:
Mitchell Hashimoto 2015-06-19 06:13:51 +02:00
parent ed4acbc903
commit 59766067c0
1 changed files with 4 additions and 2 deletions

View File

@ -4,9 +4,10 @@ import (
"bytes" "bytes"
"errors" "errors"
"fmt" "fmt"
"github.com/mitchellh/packer/packer"
"testing" "testing"
"time" "time"
"github.com/mitchellh/packer/packer"
) )
func testConfig() map[string]interface{} { func testConfig() map[string]interface{} {
@ -256,7 +257,7 @@ func TestProvision_waitForCommunicatorWithCancel(t *testing.T) {
comm := new(packer.MockCommunicator) comm := new(packer.MockCommunicator)
p.comm = comm p.comm = comm
p.ui = ui p.ui = ui
retryableSleep = 10 * time.Millisecond retryableSleep = 5 * time.Second
p.cancel = make(chan struct{}) p.cancel = make(chan struct{})
var err error var err error
@ -273,6 +274,7 @@ func TestProvision_waitForCommunicatorWithCancel(t *testing.T) {
}() }()
go func() { go func() {
time.Sleep(10 * time.Millisecond)
p.Cancel() p.Cancel()
waitDone <- true waitDone <- true
}() }()