revert test changes of builder/googlecompute/step_create_ssh_key_test.go

This commit is contained in:
Adrien Delorme 2018-08-30 12:04:21 +02:00
parent 050a98e8bb
commit 94d5bb7a3b
1 changed files with 8 additions and 8 deletions

View File

@ -3,7 +3,6 @@ package googlecompute
import (
"context"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/multistep"
"io/ioutil"
@ -18,8 +17,9 @@ func TestStepCreateSSHKey_impl(t *testing.T) {
func TestStepCreateSSHKey_privateKey(t *testing.T) {
state := testState(t)
step := new(StepCreateSSHKey)
step.Comm = new(communicator.Config)
step.Comm.SSHPrivateKeyFile = "test-fixtures/fake-key"
cfg := state.Get("config").(*Config)
cfg.Comm.SSHPrivateKeyFile = "test-fixtures/fake-key"
state.Put("config", cfg)
defer step.Cleanup(state)
// run the step
@ -28,7 +28,7 @@ func TestStepCreateSSHKey_privateKey(t *testing.T) {
}
// Verify that we have a public/private key
cfg := state.Get("config").(*Config)
cfg = state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}
@ -37,7 +37,7 @@ func TestStepCreateSSHKey_privateKey(t *testing.T) {
func TestStepCreateSSHKey(t *testing.T) {
state := testState(t)
step := new(StepCreateSSHKey)
step.Comm = new(communicator.Config)
cfg := state.Get("config").(*Config)
defer step.Cleanup(state)
// run the step
@ -46,7 +46,7 @@ func TestStepCreateSSHKey(t *testing.T) {
}
// Verify that we have a public/private key
cfg := state.Get("config").(*Config)
cfg = state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}
@ -65,7 +65,7 @@ func TestStepCreateSSHKey_debug(t *testing.T) {
state := testState(t)
step := new(StepCreateSSHKey)
step.Comm = new(communicator.Config)
cfg := state.Get("config").(*Config)
step.Debug = true
step.DebugKeyPath = tf.Name()
@ -77,7 +77,7 @@ func TestStepCreateSSHKey_debug(t *testing.T) {
}
// Verify that we have a public/private key
cfg := state.Get("config").(*Config)
cfg = state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}