update gcp ssh tests

This commit is contained in:
Adrien Delorme 2018-08-24 08:43:26 +02:00
parent 663c8134ef
commit d49ad12895
1 changed files with 8 additions and 5 deletions

View File

@ -26,7 +26,8 @@ func TestStepCreateSSHKey_privateKey(t *testing.T) {
}
// Verify that we have a public/private key
if _, ok := state.GetOk("ssh_private_key"); !ok {
cfg := state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}
}
@ -42,10 +43,11 @@ func TestStepCreateSSHKey(t *testing.T) {
}
// Verify that we have a public/private key
if _, ok := state.GetOk("ssh_private_key"); !ok {
cfg := state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}
if _, ok := state.GetOk("ssh_public_key"); !ok {
if len(cfg.Comm.SSHPublicKey) == 0 {
t.Fatal("should have key")
}
}
@ -71,10 +73,11 @@ func TestStepCreateSSHKey_debug(t *testing.T) {
}
// Verify that we have a public/private key
if _, ok := state.GetOk("ssh_private_key"); !ok {
cfg := state.Get("config").(*Config)
if len(cfg.Comm.SSHPrivateKey) == 0 {
t.Fatal("should have key")
}
if _, ok := state.GetOk("ssh_public_key"); !ok {
if len(cfg.Comm.SSHPublicKey) == 0 {
t.Fatal("should have key")
}
if _, err := os.Stat(tf.Name()); err != nil {