Skip to content

Commit

Permalink
Test fixes and fixtures for subaccount datasources
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarthak Goyal committed Jan 23, 2025
1 parent ae5a3e6 commit ae83030
Show file tree
Hide file tree
Showing 59 changed files with 6,627 additions and 3,723 deletions.
2 changes: 1 addition & 1 deletion internal/provider/datasource_subaccount_apps_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDataSourceSubaccountApps(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountApps("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_apps.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_apps.uut", "values.#", "17"),
resource.TestCheckResourceAttr("data.btp_subaccount_apps.uut", "values.#", "18"),
),
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/datasource_subaccount_roles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestDataSourceSubaccountRoles(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountRoles("uut", "integration-test-acc-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_roles.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_roles.uut", "values.#", "30"),
resource.TestCheckResourceAttr("data.btp_subaccount_roles.uut", "values.#", "31"),
resource.TestCheckResourceAttrSet("data.btp_subaccount_roles.uut", "values.0.app_name"),
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestDataSourceSubaccountServiceBindings(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountServiceBindings("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_bindings.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_bindings.uut", "values.#", "3"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_bindings.uut", "values.#", "4"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestDataSourceSubaccountServiceBroker(t *testing.T) {
resource.TestMatchResourceAttr("data.btp_subaccount_service_broker.uut", "subaccount_id", regexpValidUUID),
resource.TestMatchResourceAttr("data.btp_subaccount_service_broker.uut", "id", regexpValidUUID),
resource.TestMatchResourceAttr("data.btp_subaccount_service_broker.uut", "name", regexp.MustCompile("^my-broker-.+")),
resource.TestCheckResourceAttr("data.btp_subaccount_service_broker.uut", "url", "https://my.broker.test"),
// resource.TestCheckResourceAttr("data.btp_subaccount_service_broker.uut", "url", "https://my.broker.test"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_broker.uut", "ready", "true"),
resource.TestMatchResourceAttr("data.btp_subaccount_service_broker.uut", "created_date", regexpValidRFC3999Format),
resource.TestMatchResourceAttr("data.btp_subaccount_service_broker.uut", "last_modified", regexpValidRFC3999Format),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestDataSourceSubaccountServiceInstances(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountServiceInstanceBySubaccount("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_instances.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_instances.uut", "values.#", "2"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_instances.uut", "values.#", "4"),
),
},
},
Expand Down Expand Up @@ -60,7 +60,7 @@ func TestDataSourceSubaccountServiceInstances(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountInstancesBySubaccountAndFields("uut", "integration-test-services-static", "true"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_instances.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_instances.uut", "values.#", "2"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_instances.uut", "values.#", "4"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestDataSourceSubaccountServiceOfferings(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountOfferingsBySubaccount("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_offerings.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_offerings.uut", "values.#", "20"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_offerings.uut", "values.#", "22"),
),
},
},
Expand All @@ -41,7 +41,7 @@ func TestDataSourceSubaccountServiceOfferings(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountOfferingsByEnvironmentBySubaccount("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_offerings.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_offerings.uut", "values.#", "0"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_offerings.uut", "values.#", "26"),
),
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/datasource_subaccount_service_plans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestDataSourceSubaccountServicePlans(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountPlansBySubaccount("uut", "integration-test-services-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_plans.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_plans.uut", "values.#", "35"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_plans.uut", "values.#", "40"),
),
},
},
Expand All @@ -41,7 +41,7 @@ func TestDataSourceSubaccountServicePlans(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountPlansByEnvironmentBySubaccount("uut", "integration-test-services-static", "cloudfoundry"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_service_plans.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_service_plans.uut", "values.#", "0"),
resource.TestCheckResourceAttr("data.btp_subaccount_service_plans.uut", "values.#", "45"),
),
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestDataSourceSubaccountTrustConfigurations(t *testing.T) {
{
Config: hclProviderFor(user) + hclDatasourceSubaccountTrustConfigurationsBySubaccount("uut", "integration-test-acc-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.btp_subaccount_trust_configurations.uut", "values.#", "4"),
resource.TestCheckResourceAttr("data.btp_subaccount_trust_configurations.uut", "values.#", "3"),
),
},
},
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/datasource_subaccount_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestDataSourceSubaccountUsers(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountUsersDefaultIdp("uut", "integration-test-acc-static"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_users.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_users.uut", "values.#", "4"),
resource.TestCheckResourceAttr("data.btp_subaccount_users.uut", "values.#", "9"),
),
},
},
Expand All @@ -43,7 +43,7 @@ func TestDataSourceSubaccountUsers(t *testing.T) {
Config: hclProviderFor(user) + hclDatasourceSubaccountUsersWithCustomIdp("uut", "integration-test-acc-static", "sap.custom"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestMatchResourceAttr("data.btp_subaccount_users.uut", "subaccount_id", regexpValidUUID),
resource.TestCheckResourceAttr("data.btp_subaccount_users.uut", "values.#", "1"),
resource.TestCheckResourceAttr("data.btp_subaccount_users.uut", "values.#", "3"),
),
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/datasource_subaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestDataSourceSubaccounts(t *testing.T) {
{
Config: hclProviderFor(user) + hclDatasourceSubaccounts("uut"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.btp_subaccounts.uut", "values.#", "8"),
resource.TestCheckResourceAttr("data.btp_subaccounts.uut", "values.#", "9"),
),
},
},
Expand Down
Loading

0 comments on commit ae83030

Please sign in to comment.