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: use active deployment templates for acc tests #876

Merged
merged 9 commits into from
Nov 20, 2024
4 changes: 2 additions & 2 deletions ec/acc/datasource_deployment_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ func TestAccDatasourceDeployment_basic(t *testing.T) {
secondRandomName := prefix + "-" + acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
randomAlias := "alias" + acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
depCfg := "testdata/datasource_deployment_basic.tf"
cfgWithAutoscaling := fixtureAccDeploymentDatasourceBasicAlias(t, depCfg, randomAlias, randomName, secondRandomName, getRegion(), computeOpTemplate, "true")
cfgWithoutAutoscaling := fixtureAccDeploymentDatasourceBasicAlias(t, depCfg, randomAlias, randomName, secondRandomName, getRegion(), computeOpTemplate, "false")
cfgWithAutoscaling := fixtureAccDeploymentDatasourceBasicAlias(t, depCfg, randomAlias, randomName, secondRandomName, getRegion(), cpuOpTemplate, "true")
cfgWithoutAutoscaling := fixtureAccDeploymentDatasourceBasicAlias(t, depCfg, randomAlias, randomName, secondRandomName, getRegion(), cpuOpTemplate, "false")
var namePrefix = secondRandomName[:22]

resource.ParallelTest(t, resource.TestCase{
Expand Down
2 changes: 1 addition & 1 deletion ec/acc/deployment_autoscaling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestAccDeployment_autoscaling(t *testing.T) {
resource.TestCheckResourceAttr(resName, "elasticsearch.cold.size", "0g"),
resource.TestCheckResourceAttr(resName, "elasticsearch.cold.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "elasticsearch.cold.zone_count", "1"),
resource.TestCheckResourceAttr(resName, "elasticsearch.cold.autoscaling.max_size", "58g"),
resource.TestCheckResourceAttr(resName, "elasticsearch.cold.autoscaling.max_size", "60g"),

resource.TestCheckResourceAttr(resName, "elasticsearch.frozen.size", "0g"),
resource.TestCheckResourceAttr(resName, "elasticsearch.frozen.size_resource", "memory"),
Expand Down
45 changes: 27 additions & 18 deletions ec/acc/deployment_basic_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// This test case takes ensures that several features of the "ec_deployment"
// resource are asserted:
// * Resource defaults.
// * Resource declaration in the <kind> {} format. ("apm {}").
// * Resource declaration in the <kind> {} format. ("integrations_server {}").
// * Topology field overrides over field defaults.
func TestAccDeployment_basic_defaults_first(t *testing.T) {
resName := "ec_deployment.defaults"
Expand Down Expand Up @@ -60,15 +60,15 @@ func TestAccDeployment_basic_defaults_first(t *testing.T) {
resource.TestCheckResourceAttr(resName, "kibana.size", "1g"),
resource.TestCheckResourceAttr(resName, "kibana.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "kibana.zone_count", "1"),
resource.TestCheckNoResourceAttr(resName, "apm"),
resource.TestCheckNoResourceAttr(resName, "integrations_server"),
resource.TestCheckResourceAttrSet(resName, "enterprise_search.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size", "2g"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "enterprise_search.zone_count", "1"),
),
},
{
// Add an APM resource.
// Add an APM resource size.
Config: secondConfigCfg,
Check: resource.ComposeAggregateTestCheckFunc(
// changed
Expand All @@ -81,10 +81,10 @@ func TestAccDeployment_basic_defaults_first(t *testing.T) {
resource.TestCheckResourceAttrSet(resName, "kibana.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "kibana.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "kibana.zone_count", "1"),
resource.TestCheckResourceAttr(resName, "apm.size", "1g"),
resource.TestCheckResourceAttrSet(resName, "apm.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "apm.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "apm.zone_count", "1"),
resource.TestCheckResourceAttr(resName, "integrations_server.size", "2g"),
resource.TestCheckResourceAttrSet(resName, "integrations_server.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "integrations_server.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "integrations_server.zone_count", "1"),
resource.TestCheckResourceAttrSet(resName, "enterprise_search.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size", "2g"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size_resource", "memory"),
Expand All @@ -109,7 +109,7 @@ func TestAccDeployment_basic_defaults_first(t *testing.T) {
// values are used.
resource.TestCheckResourceAttr(resName, "kibana.size", "2g"),
resource.TestCheckResourceAttr(resName, "kibana.zone_count", "1"),
resource.TestCheckNoResourceAttr(resName, "apm"),
resource.TestCheckNoResourceAttr(resName, "integrations_server"),
resource.TestCheckNoResourceAttr(resName, "enterprise_search"),
),
},
Expand All @@ -123,7 +123,7 @@ func TestAccDeployment_basic_defaults_hw(t *testing.T) {
startCfg := "testdata/deployment_basic_defaults_hw_1.tf"
secondCfg := "testdata/deployment_basic_defaults_hw_2.tf"
cfg := fixtureAccDeploymentResourceBasicDefaults(t, startCfg, randomName, getRegion(), defaultTemplate)
hotWarmCfg := fixtureAccDeploymentResourceBasicDefaults(t, secondCfg, randomName, getRegion(), hotWarmTemplate)
generalPurposeCfg := fixtureAccDeploymentResourceBasicDefaults(t, secondCfg, randomName, getRegion(), generalPurposeTemplate)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Expand All @@ -139,19 +139,28 @@ func TestAccDeployment_basic_defaults_hw(t *testing.T) {
resource.TestCheckResourceAttr(resName, "elasticsearch.hot.size_resource", "memory"),
resource.TestCheckResourceAttrSet(resName, "elasticsearch.hot.node_roles.#"),
resource.TestCheckResourceAttr(resName, "elasticsearch.hot.zone_count", "2"),
resource.TestCheckNoResourceAttr(resName, "kibana"),
resource.TestCheckNoResourceAttr(resName, "apm"),
resource.TestCheckNoResourceAttr(resName, "enterprise_search"),

resource.TestCheckResourceAttrSet(resName, "kibana.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "kibana.size", "1g"),
resource.TestCheckResourceAttr(resName, "kibana.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "kibana.zone_count", "1"),
resource.TestCheckResourceAttrSet(resName, "integrations_server.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "integrations_server.size", "1g"),
resource.TestCheckResourceAttr(resName, "integrations_server.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "integrations_server.zone_count", "1"),
resource.TestCheckResourceAttrSet(resName, "enterprise_search.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size", "2g"),
resource.TestCheckResourceAttr(resName, "enterprise_search.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "enterprise_search.zone_count", "1"),
),
},
{
// Change the Elasticsearch resource deployment template to
// hot warm, use defaults.
Config: hotWarmCfg,
// Change the Elasticsearch resource deployment template to use defaults.
Config: generalPurposeCfg,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet(resName, "elasticsearch.hot.instance_configuration_id"),
resource.TestCheckResourceAttrSet(resName, "elasticsearch.warm.instance_configuration_id"),
// Hot Warm defaults to 4g.
// general purpose config set to 4g.
resource.TestCheckResourceAttr(resName, "elasticsearch.hot.size", "4g"),
resource.TestCheckResourceAttr(resName, "elasticsearch.hot.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "elasticsearch.warm.size", "4g"),
Expand All @@ -160,11 +169,11 @@ func TestAccDeployment_basic_defaults_hw(t *testing.T) {
resource.TestCheckResourceAttr(resName, "elasticsearch.hot.zone_count", "2"),
resource.TestCheckResourceAttrSet(resName, "elasticsearch.warm.node_roles.#"),
resource.TestCheckResourceAttr(resName, "elasticsearch.warm.zone_count", "2"),
resource.TestCheckResourceAttr(resName, "kibana.size", "1g"),
resource.TestCheckResourceAttrSet(resName, "kibana.instance_configuration_id"),
resource.TestCheckResourceAttr(resName, "kibana.size", "1g"),
resource.TestCheckResourceAttr(resName, "kibana.size_resource", "memory"),
resource.TestCheckResourceAttr(resName, "kibana.zone_count", "1"),
resource.TestCheckNoResourceAttr(resName, "apm"),
resource.TestCheckNoResourceAttr(resName, "integrations_server"),
resource.TestCheckNoResourceAttr(resName, "enterprise_search"),
),
},
Expand Down
146 changes: 0 additions & 146 deletions ec/acc/deployment_ccs_test.go

This file was deleted.

Loading
Loading