From d49ad12895a5ab1c32878d4492bcb1385fa26a1b Mon Sep 17 00:00:00 2001 From: Adrien Delorme Date: Fri, 24 Aug 2018 08:43:26 +0200 Subject: [PATCH] update gcp ssh tests --- builder/googlecompute/step_create_ssh_key_test.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/builder/googlecompute/step_create_ssh_key_test.go b/builder/googlecompute/step_create_ssh_key_test.go index 5e5150738..fbd8ae240 100644 --- a/builder/googlecompute/step_create_ssh_key_test.go +++ b/builder/googlecompute/step_create_ssh_key_test.go @@ -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 {