From a2cad7d579adb57ea14990779160134e69834082 Mon Sep 17 00:00:00 2001 From: tombuildsstuff Date: Wed, 17 Nov 2021 18:43:39 +0100 Subject: [PATCH] internal/backend/remote-state/azure: prefixing the existing tests with ADAL --- .../remote-state/azure/backend_test.go | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/internal/backend/remote-state/azure/backend_test.go b/internal/backend/remote-state/azure/backend_test.go index 8ae20a31ae..51dbc6106a 100644 --- a/internal/backend/remote-state/azure/backend_test.go +++ b/internal/backend/remote-state/azure/backend_test.go @@ -65,34 +65,6 @@ func TestBackendAccessKeyBasic(t *testing.T) { backend.TestBackendStates(t, b) } -func TestBackendManagedServiceIdentityBasic(t *testing.T) { - testAccAzureBackendRunningInAzure(t) - rs := acctest.RandString(4) - res := testResourceNames(rs, "testState") - armClient := buildTestClient(t, res) - - ctx := context.TODO() - err := armClient.buildTestResources(ctx, &res) - defer armClient.destroyTestResources(ctx, res) - if err != nil { - t.Fatalf("Error creating Test Resources: %q", err) - } - - b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{ - "storage_account_name": res.storageAccountName, - "container_name": res.storageContainerName, - "key": res.storageKeyName, - "resource_group_name": res.resourceGroup, - "use_msi": true, - "subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"), - "tenant_id": os.Getenv("ARM_TENANT_ID"), - "environment": os.Getenv("ARM_ENVIRONMENT"), - "endpoint": os.Getenv("ARM_ENDPOINT"), - })).(*Backend) - - backend.TestBackendStates(t, b) -} - func TestBackendSASTokenBasic(t *testing.T) { testAccAzureBackend(t) rs := acctest.RandString(4) @@ -123,7 +95,7 @@ func TestBackendSASTokenBasic(t *testing.T) { backend.TestBackendStates(t, b) } -func TestBackendAzureADAuthBasic(t *testing.T) { +func TestBackendADALAzureADAuthBasic(t *testing.T) { testAccAzureBackend(t) rs := acctest.RandString(4) res := testResourceNames(rs, "testState") @@ -151,7 +123,35 @@ func TestBackendAzureADAuthBasic(t *testing.T) { backend.TestBackendStates(t, b) } -func TestBackendServicePrincipalClientCertificateBasic(t *testing.T) { +func TestBackendADALManagedServiceIdentityBasic(t *testing.T) { + testAccAzureBackendRunningInAzure(t) + rs := acctest.RandString(4) + res := testResourceNames(rs, "testState") + armClient := buildTestClient(t, res) + + ctx := context.TODO() + err := armClient.buildTestResources(ctx, &res) + defer armClient.destroyTestResources(ctx, res) + if err != nil { + t.Fatalf("Error creating Test Resources: %q", err) + } + + b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{ + "storage_account_name": res.storageAccountName, + "container_name": res.storageContainerName, + "key": res.storageKeyName, + "resource_group_name": res.resourceGroup, + "use_msi": true, + "subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"), + "tenant_id": os.Getenv("ARM_TENANT_ID"), + "environment": os.Getenv("ARM_ENVIRONMENT"), + "endpoint": os.Getenv("ARM_ENDPOINT"), + })).(*Backend) + + backend.TestBackendStates(t, b) +} + +func TestBackendADALServicePrincipalClientCertificateBasic(t *testing.T) { testAccAzureBackend(t) clientCertPassword := os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD") @@ -188,7 +188,7 @@ func TestBackendServicePrincipalClientCertificateBasic(t *testing.T) { backend.TestBackendStates(t, b) } -func TestBackendServicePrincipalClientSecretBasic(t *testing.T) { +func TestBackendADALServicePrincipalClientSecretBasic(t *testing.T) { testAccAzureBackend(t) rs := acctest.RandString(4) res := testResourceNames(rs, "testState") @@ -217,7 +217,7 @@ func TestBackendServicePrincipalClientSecretBasic(t *testing.T) { backend.TestBackendStates(t, b) } -func TestBackendServicePrincipalClientSecretCustomEndpoint(t *testing.T) { +func TestBackendADALServicePrincipalClientSecretCustomEndpoint(t *testing.T) { testAccAzureBackend(t) // this is only applicable for Azure Stack.