Skip to content

Commit

Permalink
Reset node_roles on master change.
Browse files Browse the repository at this point in the history
  • Loading branch information
gigerdo committed Apr 30, 2024
1 parent 10861ec commit bb68f78
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions ec/acc/deployment_add_dedicated_master_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package acc

import (
"errors"
"fmt"
"os"
"testing"
Expand All @@ -28,7 +29,7 @@ import (

func TestAccDeployment_add_dedicated_master(t *testing.T) {
resName := "ec_deployment.auto_dedicated_master"
randomName := prefix + acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)
randomName := prefix + "TestAccDeployment_add_dedicated_master_" + acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)

cfg5nodes := buildConfiguration(t, "testdata/deployment_dedicated_master_5_nodes.tf", randomName, getRegion(), defaultTemplate)
cfg6nodes := buildConfiguration(t, "testdata/deployment_dedicated_master_6_nodes.tf", randomName, getRegion(), defaultTemplate)
Expand All @@ -42,8 +43,24 @@ func TestAccDeployment_add_dedicated_master(t *testing.T) {
Config: cfg6nodes,
Check: resource.ComposeAggregateTestCheckFunc(
// Master tier should be enabled
resource.TestCheckResourceAttr(resName, "elasticsearch.master.size", "4g"),
resource.TestCheckResourceAttr(resName, "elasticsearch.master.zone_count", "3"),
resource.TestCheckResourceAttrWith(
resName,
"elasticsearch.master.size",
func(v string) error {
if v == "0g" || v == "" {
return errors.New("master size should not be empty. size=" + v)
}
return nil
}),
resource.TestCheckResourceAttrWith(
resName,
"elasticsearch.master.zone_count",
func(v string) error {
if v == "0" || v == "" {
return errors.New("master zone_count should not be empty. zone_count=" + v)
}
return nil
}),
),
},
{
Expand Down

0 comments on commit bb68f78

Please sign in to comment.