-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add upgrade tests to detect breaking changes (#474)
* add upgrade tests to detect breaking changes * add more tests
- Loading branch information
Showing
14 changed files
with
905 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
internal/services/azapi_data_plane_resource_upgrade_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package services_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Azure/terraform-provider-azapi/internal/acceptance" | ||
"github.com/Azure/terraform-provider-azapi/internal/acceptance/check" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccAzapiDataPlaneResourceUpgrade_appConfigKeyValues(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_data_plane_resource", "test") | ||
r := DataPlaneResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.appConfigKeyValues(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.appConfigKeyValues(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiDataPlaneResourceUpgrade_purviewClassification(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_data_plane_resource", "test") | ||
r := DataPlaneResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.purviewClassification(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.purviewClassification(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiDataPlaneResourceUpgrade_purviewCollection(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_data_plane_resource", "test") | ||
r := DataPlaneResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.purviewCollection(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.purviewCollection(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiDataPlaneResourceUpgrade_keyVaultIssuer(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_data_plane_resource", "test") | ||
r := DataPlaneResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.keyVaultIssuer(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.keyVaultIssuer(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiDataPlaneResourceUpgrade_iotAppsUser(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_data_plane_resource", "test") | ||
r := DataPlaneResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.iotAppsUser(data), | ||
Check: resource.ComposeTestCheckFunc( | ||
check.That(data.ResourceName).ExistsInAzure(r), | ||
), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.iotAppsUser(data), | ||
}), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
internal/services/azapi_resource_action_resource_upgrade_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package services_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/Azure/terraform-provider-azapi/internal/acceptance" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccAzapiActionResourceUpgrade_basic(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.basic(data), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.basic(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiActionResourceUpgrade_basicWhenDestroy(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.basicWhenDestroy(data), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.basicWhenDestroy(data), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiActionResourceUpgrade_registerResourceProvider(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.registerResourceProvider(), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.registerResourceProvider(), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiActionResourceUpgrade_upgradeFromVeryOldVersion(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.registerResourceProvider(), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, "1.8.0"), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.registerResourceProvider(), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiActionResourceUpgrade_providerAction(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.providerAction(), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.providerAction(), | ||
}), | ||
}) | ||
} | ||
|
||
func TestAccAzapiActionResourceUpgrade_nonstandardLRO(t *testing.T) { | ||
data := acceptance.BuildTestData(t, "azapi_resource_action", "test") | ||
r := ActionResource{} | ||
|
||
data.UpgradeTest(t, r, []resource.TestStep{ | ||
data.UpgradeTestDeployStep(resource.TestStep{ | ||
Config: r.nonstandardLRO(data), | ||
Check: resource.ComposeTestCheckFunc(), | ||
}, PreviousVersion), | ||
data.UpgradeTestPlanStep(resource.TestStep{ | ||
Config: r.nonstandardLRO(data), | ||
}), | ||
}) | ||
} |
Oops, something went wrong.