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

test: Uses ComposeAggregateTestCheckFunc for soft assertions #2375

Merged
merged 1 commit into from
Jul 1, 2024
Merged
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
2 changes: 1 addition & 1 deletion internal/provider/provider_authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestAccSTSAssumeRole_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configProject(orgID, projectName),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "name", projectName),
resource.TestCheckResourceAttr(resourceName, "cluster_count", "0"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestAccConfigDSAccesslistAPIKey_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configDS(orgID, description, ipAddress),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttrSet(resourceName, "org_id"),
resource.TestCheckResourceAttrSet(resourceName, "ip_address"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestAccConfigDSAccesslistAPIKeys_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configDSPlural(orgID, description, ipAddress),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttrSet(resourceName, "org_id"),
resource.TestCheckResourceAttrSet(resourceName, "ip_address"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestMigProjectAccesslistAPIKey_SettingIPAddress(t *testing.T) {
{
ExternalProviders: mig.ExternalProviders(),
Config: configWithIPAddress(orgID, description, ipAddress),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "ip_address", ipAddress),
Expand Down Expand Up @@ -54,7 +54,7 @@ func TestMigProjectAccesslistAPIKey_SettingCIDRBlock(t *testing.T) {
{
ExternalProviders: acc.ExternalProviders("1.14.0"),
Config: configWithCIDRBlock(orgID, description, cidrBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock),
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestMigProjectAccesslistAPIKey_SettingCIDRBlock_WideCIDR_SDKMigration(t *te
{
ExternalProviders: acc.ExternalProviders("1.14.0"),
Config: configWithCIDRBlock(orgID, description, cidrBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ func TestAccProjectRSAccesslistAPIKey_SettingIPAddress(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithIPAddress(orgID, description, ipAddress),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "ip_address", ipAddress),
),
},
{
Config: configWithIPAddress(orgID, description, updatedIPAddress),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "ip_address", updatedIPAddress),
Expand Down Expand Up @@ -68,15 +68,15 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithCIDRBlock(orgID, description, cidrBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock),
),
},
{
Config: configWithCIDRBlock(orgID, description, updatedCIDRBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", updatedCIDRBlock),
Expand All @@ -102,15 +102,15 @@ func TestAccProjectRSAccessListAPIKey_SettingCIDRBlock_WideCIDR(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithCIDRBlock(orgID, description, cidrBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", cidrBlock),
),
},
{
Config: configWithCIDRBlock(orgID, description, updatedCIDRBlock),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "org_id", orgID),
resource.TestCheckResourceAttr(resourceName, "cidr_block", updatedCIDRBlock),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestAccConfigDSAlertConfiguration_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configBasicDS(projectID),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID),
resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"),
Expand All @@ -47,7 +47,7 @@ func TestAccConfigDSAlertConfiguration_withThreshold(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithThreshold(projectID, true, 1),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID),
resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"),
Expand All @@ -73,7 +73,7 @@ func TestAccConfigDSAlertConfiguration_withOutput(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithOutputs(projectID, outputLabel),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID),
resource.TestCheckResourceAttr(dataSourceName, "notification.#", "1"),
Expand Down Expand Up @@ -102,7 +102,7 @@ func TestAccConfigDSAlertConfiguration_withPagerDuty(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithPagerDutyDS(projectID, serviceKey, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(dataSourceName),
resource.TestCheckResourceAttr(dataSourceName, "project_id", projectID),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestAccConfigDSAlertConfigurations_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configBasicPluralDS(projectID),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkCount(dataSourcePluralName),
resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID),
resource.TestCheckNoResourceAttr(dataSourcePluralName, "total_count"),
Expand All @@ -48,7 +48,7 @@ func TestAccConfigDSAlertConfigurations_withOutputTypes(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configOutputType(projectID, outputTypes),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkCount(dataSourcePluralName),
resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID),
resource.TestCheckResourceAttr(dataSourcePluralName, "results.0.output.#", "2"),
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestAccConfigDSAlertConfigurations_totalCount(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configTotalCount(projectID),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkCount(dataSourcePluralName),
resource.TestCheckResourceAttr(dataSourcePluralName, "project_id", projectID),
resource.TestCheckResourceAttrSet(dataSourcePluralName, "total_count"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestMigConfigRSAlertConfiguration_withNotificationsMetricThreshold(t *testi
{
ExternalProviders: mig.ExternalProviders(),
Config: config,
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "2"),
Expand All @@ -45,7 +45,7 @@ func TestMigConfigRSAlertConfiguration_withThreshold(t *testing.T) {
{
ExternalProviders: mig.ExternalProviders(),
Config: config,
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "1"),
Expand All @@ -71,7 +71,7 @@ func TestMigConfigRSAlertConfiguration_withEmptyOptionalBlocks(t *testing.T) {
{
ExternalProviders: mig.ExternalProviders(),
Config: config,
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "1"),
Expand Down Expand Up @@ -108,7 +108,7 @@ func TestMigConfigRSAlertConfiguration_withMultipleMatchers(t *testing.T) {
{
ExternalProviders: mig.ExternalProviders(),
Config: config,
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "matcher.#", "2"),
Expand All @@ -132,7 +132,7 @@ func TestMigConfigRSAlertConfiguration_withEmptyOptionalAttributes(t *testing.T)
{
ExternalProviders: mig.ExternalProviders(),
Config: config,
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "1"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ func TestAccConfigRSAlertConfiguration_basic(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configBasicRS(projectID, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "2"),
),
},
{
Config: configBasicRS(projectID, false),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "2"),
Expand Down Expand Up @@ -93,7 +93,7 @@ func TestAccConfigRSAlertConfiguration_withEmptyMatcherMetricThresholdConfig(t *
Steps: []resource.TestStep{
{
Config: configWithEmptyMatcherMetricThresholdConfig(projectID, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.#", "1"),
Expand All @@ -116,14 +116,14 @@ func TestAccConfigRSAlertConfiguration_withNotifications(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithNotifications(projectID, true, true, false),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
},
{
Config: configWithNotifications(projectID, false, false, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand Down Expand Up @@ -163,7 +163,7 @@ func TestAccConfigRSAlertConfiguration_withMatchers(t *testing.T) {
"operator": "CONTAINS",
"value": "MONGOS",
}),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -180,7 +180,7 @@ func TestAccConfigRSAlertConfiguration_withMatchers(t *testing.T) {
"operator": "EQUALS",
"value": "PRIMARY",
}),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -203,14 +203,14 @@ func TestAccConfigRSAlertConfiguration_withMetricUpdated(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithMetricUpdated(projectID, true, 99.0),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
},
{
Config: configWithMetricUpdated(projectID, false, 89.7),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -233,14 +233,14 @@ func TestAccConfigRSAlertConfiguration_withThresholdUpdated(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithThresholdUpdated(projectID, true, 1),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
},
{
Config: configWithThresholdUpdated(projectID, false, 3),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestAccConfigRSAlertConfiguration_withoutRoles(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithoutRoles(projectID, true, 99.0),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -293,7 +293,7 @@ func TestAccConfigRSAlertConfiguration_withoutOptionalAttributes(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithEmptyOptionalAttributes(projectID),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand Down Expand Up @@ -347,7 +347,7 @@ func TestAccConfigRSAlertConfiguration_updatePagerDutyWithNotifierId(t *testing.
Steps: []resource.TestStep{
{
Config: configWithPagerDutyNotifierID(projectID, notifierID, 10, &serviceKey),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.0.delay_min", "10"),
Expand All @@ -356,7 +356,7 @@ func TestAccConfigRSAlertConfiguration_updatePagerDutyWithNotifierId(t *testing.
},
{
Config: configWithPagerDutyNotifierID(projectID, notifierID, 15, nil),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
resource.TestCheckResourceAttr(resourceName, "notification.0.delay_min", "15"),
Expand All @@ -382,7 +382,7 @@ func TestAccConfigRSAlertConfiguration_withDataDog(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithDataDog(projectID, ddAPIKey, ddRegion, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -406,7 +406,7 @@ func TestAccConfigRSAlertConfiguration_withPagerDuty(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithPagerDuty(projectID, serviceKey, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand Down Expand Up @@ -437,7 +437,7 @@ func TestAccConfigAlertConfiguration_PagerDutyUsingIntegrationID(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithPagerDutyIntegrationID(orgID, projectName, serviceKey),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(nil, resourceName),
resource.TestCheckResourceAttrSet(resourceName, "notification.0.integration_id"),
resource.TestCheckResourceAttrSet(dataSourceName, "notification.0.integration_id"),
Expand All @@ -462,7 +462,7 @@ func TestAccConfigRSAlertConfiguration_withOpsGenie(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithOpsGenie(projectID, apiKey, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand All @@ -486,7 +486,7 @@ func TestAccConfigRSAlertConfiguration_withVictorOps(t *testing.T) {
Steps: []resource.TestStep{
{
Config: configWithVictorOps(projectID, apiKey, true),
Check: resource.ComposeTestCheckFunc(
Check: resource.ComposeAggregateTestCheckFunc(
checkExistsUsingProxy(proxyPort, resourceName),
resource.TestCheckResourceAttr(resourceName, "project_id", projectID),
),
Expand Down
Loading