Skip to content

Commit ac9337f

Browse files
committed
Merge pull request hashicorp#4428 from hashicorp/f-azure-acceptance
provider/azure: Copy settings file into variable
2 parents 2a75760 + 6b5c1d5 commit ac9337f

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

builtin/providers/azure/provider_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,22 @@ func TestProvider_impl(t *testing.T) {
5151
}
5252

5353
func testAccPreCheck(t *testing.T) {
54-
v1 := os.Getenv("AZURE_PUBLISH_SETTINGS")
55-
v2 := os.Getenv("AZURE_SETTINGS_FILE")
54+
sf := os.Getenv("PUBLISH_SETTINGS_FILE")
55+
if sf != "" {
56+
publishSettings, err := ioutil.ReadFile(sf)
57+
if err != nil {
58+
t.Fatalf("Error reading AZURE_SETTINGS_FILE path: %s", err)
59+
}
60+
61+
os.Setenv("AZURE_PUBLISH_SETTINGS", string(publishSettings))
62+
}
5663

57-
if v1 == "" && v2 == "" {
64+
if v := os.Getenv("AZURE_PUBLISH_SETTINGS"); v == "" {
5865
subscriptionID := os.Getenv("AZURE_SUBSCRIPTION_ID")
5966
certificate := os.Getenv("AZURE_CERTIFICATE")
6067

6168
if subscriptionID == "" || certificate == "" {
62-
t.Fatal("either AZURE_PUBLISH_SETTINGS, AZURE_SETTINGS_FILE, or AZURE_SUBSCRIPTION_ID " +
69+
t.Fatal("either AZURE_PUBLISH_SETTINGS, PUBLISH_SETTINGS_FILE, or AZURE_SUBSCRIPTION_ID " +
6370
"and AZURE_CERTIFICATE must be set for acceptance tests")
6471
}
6572
}

0 commit comments

Comments
 (0)