2023-05-02 10:33:06 -05:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2017-03-30 09:33:54 -05:00
|
|
|
package azure
|
|
|
|
|
|
|
|
import (
|
2018-11-21 15:06:03 -06:00
|
|
|
"context"
|
2017-03-30 09:33:54 -05:00
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
2023-08-17 07:45:11 -05:00
|
|
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/backend"
|
|
|
|
"github.com/placeholderplaceholderplaceholder/opentf/internal/legacy/helper/acctest"
|
2017-03-30 09:33:54 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestBackend_impl(t *testing.T) {
|
|
|
|
var _ backend.Backend = new(Backend)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestBackendConfig(t *testing.T) {
|
|
|
|
// This test just instantiates the client. Shouldn't make any actual
|
|
|
|
// requests nor incur any costs.
|
|
|
|
|
|
|
|
config := map[string]interface{}{
|
|
|
|
"storage_account_name": "tfaccount",
|
|
|
|
"container_name": "tfcontainer",
|
|
|
|
"key": "state",
|
2020-06-25 04:50:16 -05:00
|
|
|
"snapshot": false,
|
2017-03-30 09:33:54 -05:00
|
|
|
// Access Key must be Base64
|
|
|
|
"access_key": "QUNDRVNTX0tFWQ0K",
|
|
|
|
}
|
|
|
|
|
2018-03-20 20:43:02 -05:00
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(config)).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
|
|
|
if b.containerName != "tfcontainer" {
|
|
|
|
t.Fatalf("Incorrect bucketName was populated")
|
|
|
|
}
|
|
|
|
if b.keyName != "state" {
|
|
|
|
t.Fatalf("Incorrect keyName was populated")
|
|
|
|
}
|
2020-06-25 04:50:16 -05:00
|
|
|
if b.snapshot != false {
|
|
|
|
t.Fatalf("Incorrect snapshot was populated")
|
|
|
|
}
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2022-04-26 12:20:40 -05:00
|
|
|
func TestAccBackendAccessKeyBasic(t *testing.T) {
|
2018-11-21 15:06:03 -06:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
rs := acctest.RandString(4)
|
|
|
|
res := testResourceNames(rs, "testState")
|
|
|
|
armClient := buildTestClient(t, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-22 11:02:33 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2018-11-21 15:06:03 -06:00
|
|
|
if err != nil {
|
|
|
|
armClient.destroyTestResources(ctx, res)
|
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
|
|
|
}
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-03-20 20:43:02 -05:00
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
2017-03-30 09:33:54 -05:00
|
|
|
"storage_account_name": res.storageAccountName,
|
2018-11-21 15:06:03 -06:00
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-22 11:02:33 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-03-20 20:43:02 -05:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-02-20 20:05:58 -06:00
|
|
|
backend.TestBackendStates(t, b)
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2022-04-26 12:20:40 -05:00
|
|
|
func TestAccBackendSASTokenBasic(t *testing.T) {
|
2021-11-17 11:43:39 -06:00
|
|
|
testAccAzureBackend(t)
|
2018-11-22 09:52:27 -06:00
|
|
|
rs := acctest.RandString(4)
|
|
|
|
res := testResourceNames(rs, "testState")
|
|
|
|
armClient := buildTestClient(t, res)
|
|
|
|
|
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-22 11:02:33 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2018-11-22 09:52:27 -06:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
|
|
|
}
|
|
|
|
|
2021-11-17 11:43:39 -06:00
|
|
|
sasToken, err := buildSasToken(res.storageAccountName, res.storageAccountAccessKey)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error building SAS Token: %+v", err)
|
|
|
|
}
|
|
|
|
|
2018-11-22 09:52:27 -06:00
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
2021-11-17 11:43:39 -06:00
|
|
|
"sas_token": *sasToken,
|
2018-11-22 09:52:27 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-11-22 09:52:27 -06:00
|
|
|
})).(*Backend)
|
|
|
|
|
|
|
|
backend.TestBackendStates(t, b)
|
|
|
|
}
|
|
|
|
|
2022-04-26 12:20:40 -05:00
|
|
|
func TestAccBackendOIDCBasic(t *testing.T) {
|
|
|
|
testAccAzureBackend(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_oidc": 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)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:16:04 -05:00
|
|
|
func TestAccBackendAzureADAuthBasic(t *testing.T) {
|
2018-11-21 15:06:03 -06:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
rs := acctest.RandString(4)
|
|
|
|
res := testResourceNames(rs, "testState")
|
2021-11-17 11:43:39 -06:00
|
|
|
res.useAzureADAuth = true
|
2018-11-21 15:06:03 -06:00
|
|
|
armClient := buildTestClient(t, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-22 11:02:33 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2018-11-21 15:06:03 -06:00
|
|
|
if err != nil {
|
2021-11-17 11:43:39 -06:00
|
|
|
armClient.destroyTestResources(ctx, res)
|
2018-11-21 15:06:03 -06:00
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
|
|
|
}
|
2018-11-22 11:02:33 -06:00
|
|
|
|
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
2021-11-17 11:43:39 -06:00
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-22 11:02:33 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2021-11-17 11:43:39 -06:00
|
|
|
"use_azuread_auth": true,
|
2018-11-22 11:02:33 -06:00
|
|
|
})).(*Backend)
|
|
|
|
|
|
|
|
backend.TestBackendStates(t, b)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:16:04 -05:00
|
|
|
func TestAccBackendManagedServiceIdentityBasic(t *testing.T) {
|
2021-11-17 11:43:39 -06:00
|
|
|
testAccAzureBackendRunningInAzure(t)
|
2021-03-22 12:49:34 -05:00
|
|
|
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,
|
2021-11-17 11:43:39 -06:00
|
|
|
"resource_group_name": res.resourceGroup,
|
|
|
|
"use_msi": true,
|
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
2021-03-22 12:49:34 -05:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
|
|
|
})).(*Backend)
|
|
|
|
|
|
|
|
backend.TestBackendStates(t, b)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:16:04 -05:00
|
|
|
func TestAccBackendServicePrincipalClientCertificateBasic(t *testing.T) {
|
2020-08-07 04:58:33 -05:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
|
|
|
|
clientCertPassword := os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")
|
|
|
|
clientCertPath := os.Getenv("ARM_CLIENT_CERTIFICATE_PATH")
|
|
|
|
if clientCertPath == "" {
|
|
|
|
t.Skip("Skipping since `ARM_CLIENT_CERTIFICATE_PATH` is not specified!")
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
|
|
|
"client_id": os.Getenv("ARM_CLIENT_ID"),
|
|
|
|
"client_certificate_password": clientCertPassword,
|
|
|
|
"client_certificate_path": clientCertPath,
|
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
|
|
|
})).(*Backend)
|
|
|
|
|
|
|
|
backend.TestBackendStates(t, b)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:16:04 -05:00
|
|
|
func TestAccBackendServicePrincipalClientSecretBasic(t *testing.T) {
|
2018-11-22 11:02:33 -06:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
rs := acctest.RandString(4)
|
|
|
|
res := testResourceNames(rs, "testState")
|
|
|
|
armClient := buildTestClient(t, res)
|
|
|
|
|
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-21 15:06:03 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2018-11-22 11:02:33 -06:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
|
|
|
}
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
b := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
2017-03-30 09:33:54 -05:00
|
|
|
"storage_account_name": res.storageAccountName,
|
2018-11-21 15:06:03 -06:00
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"resource_group_name": res.resourceGroup,
|
2018-11-26 04:19:43 -06:00
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
|
|
|
"client_id": os.Getenv("ARM_CLIENT_ID"),
|
|
|
|
"client_secret": os.Getenv("ARM_CLIENT_SECRET"),
|
2018-11-21 15:06:03 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
|
|
|
})).(*Backend)
|
|
|
|
|
|
|
|
backend.TestBackendStates(t, b)
|
|
|
|
}
|
|
|
|
|
2022-05-18 09:16:04 -05:00
|
|
|
func TestAccBackendServicePrincipalClientSecretCustomEndpoint(t *testing.T) {
|
2018-11-26 07:42:16 -06:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
|
|
|
|
// this is only applicable for Azure Stack.
|
|
|
|
endpoint := os.Getenv("ARM_ENDPOINT")
|
|
|
|
if endpoint == "" {
|
|
|
|
t.Skip("Skipping as ARM_ENDPOINT isn't configured")
|
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
|
|
|
"client_id": os.Getenv("ARM_CLIENT_ID"),
|
|
|
|
"client_secret": os.Getenv("ARM_CLIENT_SECRET"),
|
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
|
|
|
"endpoint": endpoint,
|
2018-03-20 20:43:02 -05:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
backend.TestBackendStates(t, b)
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2022-04-26 12:20:40 -05:00
|
|
|
func TestAccBackendAccessKeyLocked(t *testing.T) {
|
2018-11-21 15:06:03 -06:00
|
|
|
testAccAzureBackend(t)
|
2017-03-30 09:33:54 -05:00
|
|
|
rs := acctest.RandString(4)
|
2018-11-21 15:06:03 -06:00
|
|
|
res := testResourceNames(rs, "testState")
|
|
|
|
armClient := buildTestClient(t, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-22 11:02:33 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
if err != nil {
|
2018-11-21 15:06:03 -06:00
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-22 11:02:33 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-11-21 15:06:03 -06:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-22 11:02:33 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-11-21 15:06:03 -06:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
backend.TestBackendStateLocks(t, b1, b2)
|
|
|
|
backend.TestBackendStateForceUnlock(t, b1, b2)
|
2020-10-13 10:18:54 -05:00
|
|
|
|
|
|
|
backend.TestBackendStateLocksInWS(t, b1, b2, "foo")
|
|
|
|
backend.TestBackendStateForceUnlockInWS(t, b1, b2, "foo")
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2022-04-26 12:20:40 -05:00
|
|
|
func TestAccBackendServicePrincipalLocked(t *testing.T) {
|
2018-11-21 15:06:03 -06:00
|
|
|
testAccAzureBackend(t)
|
|
|
|
rs := acctest.RandString(4)
|
|
|
|
res := testResourceNames(rs, "testState")
|
|
|
|
armClient := buildTestClient(t, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
ctx := context.TODO()
|
|
|
|
err := armClient.buildTestResources(ctx, &res)
|
2018-11-22 11:02:33 -06:00
|
|
|
defer armClient.destroyTestResources(ctx, res)
|
2017-03-30 09:33:54 -05:00
|
|
|
if err != nil {
|
2018-11-21 15:06:03 -06:00
|
|
|
t.Fatalf("Error creating Test Resources: %q", err)
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
b1 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-26 04:19:43 -06:00
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
|
|
|
"client_id": os.Getenv("ARM_CLIENT_ID"),
|
|
|
|
"client_secret": os.Getenv("ARM_CLIENT_SECRET"),
|
2018-11-21 15:06:03 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-11-21 15:06:03 -06:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
b2 := backend.TestBackendConfig(t, New(), backend.TestWrapConfig(map[string]interface{}{
|
|
|
|
"storage_account_name": res.storageAccountName,
|
|
|
|
"container_name": res.storageContainerName,
|
|
|
|
"key": res.storageKeyName,
|
|
|
|
"access_key": res.storageAccountAccessKey,
|
2018-11-26 04:19:43 -06:00
|
|
|
"subscription_id": os.Getenv("ARM_SUBSCRIPTION_ID"),
|
|
|
|
"tenant_id": os.Getenv("ARM_TENANT_ID"),
|
|
|
|
"client_id": os.Getenv("ARM_CLIENT_ID"),
|
|
|
|
"client_secret": os.Getenv("ARM_CLIENT_SECRET"),
|
2018-11-21 15:06:03 -06:00
|
|
|
"environment": os.Getenv("ARM_ENVIRONMENT"),
|
2018-11-26 07:42:16 -06:00
|
|
|
"endpoint": os.Getenv("ARM_ENDPOINT"),
|
2018-11-21 15:06:03 -06:00
|
|
|
})).(*Backend)
|
2017-03-30 09:33:54 -05:00
|
|
|
|
2018-11-21 15:06:03 -06:00
|
|
|
backend.TestBackendStateLocks(t, b1, b2)
|
|
|
|
backend.TestBackendStateForceUnlock(t, b1, b2)
|
2020-10-13 10:18:54 -05:00
|
|
|
|
|
|
|
backend.TestBackendStateLocksInWS(t, b1, b2, "foo")
|
|
|
|
backend.TestBackendStateForceUnlockInWS(t, b1, b2, "foo")
|
2017-03-30 09:33:54 -05:00
|
|
|
}
|