From 8bd3e62853b7b8f4875c7bdbbffab193a0877dfa Mon Sep 17 00:00:00 2001 From: Gonzalo Peci Date: Wed, 19 Aug 2015 16:05:22 +1200 Subject: [PATCH] Because the new functionality makes the ```waitForRestart()``` function run commands it modifies the value of ```comm.StartCmd.Command``` that is being checked, we need to implement the same workaround that is being used for the ```waitForCommunicator()``` function. This should make the test work again and retain functionality. --- provisioner/windows-restart/provisioner_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/provisioner/windows-restart/provisioner_test.go b/provisioner/windows-restart/provisioner_test.go index 7a38e1579..f91f5a771 100644 --- a/provisioner/windows-restart/provisioner_test.go +++ b/provisioner/windows-restart/provisioner_test.go @@ -100,6 +100,10 @@ func TestProvisionerProvision_Success(t *testing.T) { waitForCommunicator = func(p *Provisioner) error { return nil } + waitForRestartOld := waitForRestart + waitForRestart = func(p *Provisioner, comm packer.Communicator) error { + return nil + } err := p.Provision(ui, comm) if err != nil { t.Fatal("should not have error") @@ -113,6 +117,7 @@ func TestProvisionerProvision_Success(t *testing.T) { } // Set this back! waitForCommunicator = waitForCommunicatorOld + waitForRestart = waitForRestartOld } func TestProvisionerProvision_CustomCommand(t *testing.T) { @@ -131,6 +136,10 @@ func TestProvisionerProvision_CustomCommand(t *testing.T) { waitForCommunicator = func(p *Provisioner) error { return nil } + waitForRestartOld := waitForRestart + waitForRestart = func(p *Provisioner, comm packer.Communicator) error { + return nil + } err := p.Provision(ui, comm) if err != nil { t.Fatal("should not have error") @@ -142,6 +151,7 @@ func TestProvisionerProvision_CustomCommand(t *testing.T) { } // Set this back! waitForCommunicator = waitForCommunicatorOld + waitForRestart = waitForRestartOld } func TestProvisionerProvision_RestartCommandFail(t *testing.T) {