Skip to content

Commit

Permalink
provider: test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
manicminer committed Aug 23, 2024
1 parent 7117c91 commit fbc3fa2
Showing 1 changed file with 40 additions and 39 deletions.
79 changes: 40 additions & 39 deletions internal/provider/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,45 +177,46 @@ func TestAccProvider_resourceProviders_deprecatedSkip(t *testing.T) {
}
}

// TODO - Test expected value needs updating, commenting out for now
// func TestAccProvider_resourceProviders_legacyWithAdditional(t *testing.T) {
// if !features.FourPointOhBeta() {
// t.Skip("skipping 4.0 specific test")
// }
//
// if os.Getenv("TF_ACC") == "" {
// t.Skip("TF_ACC not set")
// }
//
// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
// defer cancel()
//
// logging.SetOutput(t)
//
// provider := TestAzureProvider()
// config := map[string]interface{}{
// "resource_providers_to_register": []interface{}{
// "Microsoft.ApiManagement",
// "Microsoft.ContainerService",
// "Microsoft.KeyVault",
// "Microsoft.Kubernetes",
// },
// }
//
// if diags := provider.Configure(ctx, terraform.NewResourceConfigRaw(config)); diags != nil && diags.HasError() {
// t.Fatalf("provider failed to configure: %v", diags)
// }
//
// expectedResourceProviders := resourceproviders.Legacy().Merge(resourceproviders.ResourceProviders{
// "Microsoft.ApiManagement": {},
// "Microsoft.KeyVault": {},
// })
// registeredResourceProviders := provider.Meta().(*clients.Client).Account.RegisteredResourceProviders
//
// if !reflect.DeepEqual(registeredResourceProviders, expectedResourceProviders) {
// t.Fatalf("unexpected value for RegisteredResourceProviders: %#v", registeredResourceProviders)
// }
// }
func TestAccProvider_resourceProviders_legacyWithAdditional(t *testing.T) {
if !features.FourPointOhBeta() {
t.Skip("skipping 4.0 specific test")
}

if os.Getenv("TF_ACC") == "" {
t.Skip("TF_ACC not set")
}

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()

logging.SetOutput(t)

provider := TestAzureProvider()
config := map[string]interface{}{
"resource_providers_to_register": []interface{}{
"Microsoft.ApiManagement",
"Microsoft.ContainerService",
"Microsoft.KeyVault",
"Microsoft.Kubernetes",
},
}

if diags := provider.Configure(ctx, terraform.NewResourceConfigRaw(config)); diags != nil && diags.HasError() {
t.Fatalf("provider failed to configure: %v", diags)
}

expectedResourceProviders := resourceproviders.Legacy().Merge(resourceproviders.ResourceProviders{
"Microsoft.ApiManagement": {},
"Microsoft.ContainerService": {},
"Microsoft.KeyVault": {},
"Microsoft.Kubernetes": {},
})
registeredResourceProviders := provider.Meta().(*clients.Client).Account.RegisteredResourceProviders

if !reflect.DeepEqual(registeredResourceProviders, expectedResourceProviders) {
t.Fatalf("unexpected value for RegisteredResourceProviders: %#v", registeredResourceProviders)
}
}

func TestAccProvider_resourceProviders_core(t *testing.T) {
if !features.FourPointOhBeta() {
Expand Down

0 comments on commit fbc3fa2

Please sign in to comment.