Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

managedapplications - fix TestAccManagedApplicationDefinition_update and TestAccManagedApplication_plan #27515

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ resource "azurerm_managed_application_definition" "test" {
name = "acctestAppDef%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
lock_level = "ReadOnly"
lock_level = "None"
display_name = "UpdatedTestManagedApplicationDefinition"
description = "Updated Test Managed Application Definition"
package_enabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@ func TestAccManagedApplication_plan(t *testing.T) {

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.empty(),
Check: acceptance.ComposeTestCheckFunc(
data.CheckWithClientWithoutResource(r.cancelExistingAgreement(publisher, offer, plan)),
),
},
{
PreConfig: func() {
if err := r.cancelExistingAgreement(publisher, offer, plan); err != nil {
t.Fatalf("Failed to cancel existing agreement with error: %+v", err)
}
},
Config: r.plan(data, publisher, offer, plan),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
Expand Down Expand Up @@ -701,14 +700,6 @@ resource "azurerm_managed_application_definition" "test" {
`, data.Locations.Primary, data.RandomInteger, parameters)
}

func (ManagedApplicationResource) empty() string {
return `
provider "azurerm" {
features {}
}
`
}

func (ManagedApplicationResource) cancelExistingAgreement(publisher string, offer string, plan string) acceptance.ClientCheckFunc {
return func(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) error {
client := clients.Compute.MarketplaceAgreementsClient
Expand Down
Loading