Skip to content

Commit

Permalink
tests(): Added test TestAccRoleAssignment_capacityProviderScoped
Browse files Browse the repository at this point in the history
  • Loading branch information
Bindewald, André (UIT) authored and Bindewald, André (UIT) committed Jul 17, 2024
1 parent c3ccde4 commit 362f3cc
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions internal/services/authorization/role_assignment_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,20 @@ func TestAccRoleAssignment_resourceGroupScoped(t *testing.T) {
})
}

func TestAccRoleAssignment_capacityProviderScoped(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_role_assignment", "test")
r := RoleAssignmentResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.capacityProviderScoped(),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep("skip_service_principal_aad_check"),
})
}

func (r RoleAssignmentResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := parse.RoleAssignmentID(state.ID)
if err != nil {
Expand Down Expand Up @@ -627,3 +641,19 @@ resource "azurerm_role_assignment" "test" {
}
`, data.RandomInteger, data.Locations.Primary)
}

func (RoleAssignmentResource) capacityProviderScoped() string {
return `
provider "azurerm" {
features {}
}
data "azurerm_client_config" "test" {}
resource "azurerm_role_assignment" "test" {
scope = "/providers/Micrososoft.Capacity"
role_definition_name = "Reservations Reader"
principal_id = data.azurerm_client_config.test.object_id
}
`
}

0 comments on commit 362f3cc

Please sign in to comment.