From 81e043f2b05d34b39eeefb505dbf319ac2f2fefc Mon Sep 17 00:00:00 2001 From: Megan Marsh Date: Wed, 6 May 2020 15:18:21 -0700 Subject: [PATCH] fix windows tests --- builder/googlecompute/config_test.go | 9 ++++++--- builder/googlecompute/step_start_tunnel_test.go | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/builder/googlecompute/config_test.go b/builder/googlecompute/config_test.go index d7dd11ebc..b7c46ea56 100644 --- a/builder/googlecompute/config_test.go +++ b/builder/googlecompute/config_test.go @@ -399,17 +399,20 @@ func TestConfigPrepareIAP(t *testing.T) { t.Fatalf("Shouldn't have errors. Err = %s", err) } - if c.IAPHashBang != "/bin/sh" { - t.Fatalf("IAP hashbang didn't default correctly to /bin/sh.") - } if runtime.GOOS == "windows" { if c.IAPExt != ".cmd" { t.Fatalf("IAP tempfile extension didn't default correctly to .cmd") } + if c.IAPHashBang != "" { + t.Fatalf("IAP hashbang didn't default correctly to nothing.") + } } else { if c.IAPExt != "" { t.Fatalf("IAP tempfile extension should default to empty on unix mahcines") } + if c.IAPHashBang != "/bin/sh" { + t.Fatalf("IAP hashbang didn't default correctly to /bin/sh.") + } } if c.Comm.SSHHost != "localhost" { t.Fatalf("Didn't correctly override the ssh host.") diff --git a/builder/googlecompute/step_start_tunnel_test.go b/builder/googlecompute/step_start_tunnel_test.go index 3cf65ac3b..47813df8e 100644 --- a/builder/googlecompute/step_start_tunnel_test.go +++ b/builder/googlecompute/step_start_tunnel_test.go @@ -67,7 +67,9 @@ gcloud config set project fake-project-123 gcloud compute start-iap-tunnel fakeinstance-12345 1234 --local-host-port=localhost:8774 --zone us-central-b ` if runtime.GOOS == "windows" { - expected = ` + // in real life you'd not be passing a HashBang here, but GIGO. + expected = `#!/bin/bash + call gcloud auth activate-service-account --key-file "/path/to/account_file.json" call gcloud config set project fake-project-123 call gcloud compute start-iap-tunnel fakeinstance-12345 1234 --local-host-port=localhost:8774 --zone us-central-b