builder/vmware/common: fix failing tests on Windows
This commit is contained in:
parent
68524a3840
commit
3c59d0ef96
|
@ -28,6 +28,9 @@ import (
|
|||
type StepShutdown struct {
|
||||
Command string
|
||||
Timeout time.Duration
|
||||
|
||||
// Set this to true if we're testing
|
||||
Testing bool
|
||||
}
|
||||
|
||||
func (s *StepShutdown) Run(state multistep.StateBag) multistep.StepAction {
|
||||
|
@ -134,7 +137,7 @@ LockWaitLoop:
|
|||
}
|
||||
}
|
||||
|
||||
if runtime.GOOS == "windows" {
|
||||
if runtime.GOOS == "windows" && !s.Testing {
|
||||
// Windows takes a while to yield control of the files when the
|
||||
// process is exiting. We just sleep here. In the future, it'd be
|
||||
// nice to find a better solution to this.
|
||||
|
|
|
@ -33,6 +33,7 @@ func TestStepShutdown_command(t *testing.T) {
|
|||
step := new(StepShutdown)
|
||||
step.Command = "foo"
|
||||
step.Timeout = 10 * time.Second
|
||||
step.Testing = true
|
||||
|
||||
comm := state.Get("communicator").(*packer.MockCommunicator)
|
||||
driver := state.Get("driver").(*DriverMock)
|
||||
|
@ -116,6 +117,7 @@ func TestStepShutdown_noCommand(t *testing.T) {
|
|||
func TestStepShutdown_locks(t *testing.T) {
|
||||
state := testStepShutdownState(t)
|
||||
step := new(StepShutdown)
|
||||
step.Testing = true
|
||||
|
||||
dir := state.Get("dir").(*LocalOutputDir)
|
||||
comm := state.Get("communicator").(*packer.MockCommunicator)
|
||||
|
|
Loading…
Reference in New Issue