revert test changes of builder/googlecompute/step_create_ssh_key_test.go
This commit is contained in:
parent
050a98e8bb
commit
94d5bb7a3b
|
@ -3,7 +3,6 @@ package googlecompute
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/hashicorp/packer/helper/communicator"
|
|
||||||
"github.com/hashicorp/packer/helper/multistep"
|
"github.com/hashicorp/packer/helper/multistep"
|
||||||
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
@ -18,8 +17,9 @@ func TestStepCreateSSHKey_impl(t *testing.T) {
|
||||||
func TestStepCreateSSHKey_privateKey(t *testing.T) {
|
func TestStepCreateSSHKey_privateKey(t *testing.T) {
|
||||||
state := testState(t)
|
state := testState(t)
|
||||||
step := new(StepCreateSSHKey)
|
step := new(StepCreateSSHKey)
|
||||||
step.Comm = new(communicator.Config)
|
cfg := state.Get("config").(*Config)
|
||||||
step.Comm.SSHPrivateKeyFile = "test-fixtures/fake-key"
|
cfg.Comm.SSHPrivateKeyFile = "test-fixtures/fake-key"
|
||||||
|
state.Put("config", cfg)
|
||||||
defer step.Cleanup(state)
|
defer step.Cleanup(state)
|
||||||
|
|
||||||
// run the step
|
// run the step
|
||||||
|
@ -28,7 +28,7 @@ func TestStepCreateSSHKey_privateKey(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that we have a public/private key
|
// Verify that we have a public/private key
|
||||||
cfg := state.Get("config").(*Config)
|
cfg = state.Get("config").(*Config)
|
||||||
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
||||||
t.Fatal("should have key")
|
t.Fatal("should have key")
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func TestStepCreateSSHKey_privateKey(t *testing.T) {
|
||||||
func TestStepCreateSSHKey(t *testing.T) {
|
func TestStepCreateSSHKey(t *testing.T) {
|
||||||
state := testState(t)
|
state := testState(t)
|
||||||
step := new(StepCreateSSHKey)
|
step := new(StepCreateSSHKey)
|
||||||
step.Comm = new(communicator.Config)
|
cfg := state.Get("config").(*Config)
|
||||||
defer step.Cleanup(state)
|
defer step.Cleanup(state)
|
||||||
|
|
||||||
// run the step
|
// run the step
|
||||||
|
@ -46,7 +46,7 @@ func TestStepCreateSSHKey(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that we have a public/private key
|
// Verify that we have a public/private key
|
||||||
cfg := state.Get("config").(*Config)
|
cfg = state.Get("config").(*Config)
|
||||||
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
||||||
t.Fatal("should have key")
|
t.Fatal("should have key")
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func TestStepCreateSSHKey_debug(t *testing.T) {
|
||||||
|
|
||||||
state := testState(t)
|
state := testState(t)
|
||||||
step := new(StepCreateSSHKey)
|
step := new(StepCreateSSHKey)
|
||||||
step.Comm = new(communicator.Config)
|
cfg := state.Get("config").(*Config)
|
||||||
step.Debug = true
|
step.Debug = true
|
||||||
step.DebugKeyPath = tf.Name()
|
step.DebugKeyPath = tf.Name()
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func TestStepCreateSSHKey_debug(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify that we have a public/private key
|
// Verify that we have a public/private key
|
||||||
cfg := state.Get("config").(*Config)
|
cfg = state.Get("config").(*Config)
|
||||||
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
if len(cfg.Comm.SSHPrivateKey) == 0 {
|
||||||
t.Fatal("should have key")
|
t.Fatal("should have key")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue