Skip to content

Commit

Permalink
test: Fix test functions
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Jul 31, 2017
1 parent 53ccd7c commit 700bb88
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aws/resource_aws_elasticsearch_domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,26 @@ func TestAccAWSElasticSearchDomain_update(t *testing.T) {
Config: testAccESDomainConfig_ClusterUpdate(ri, 4, 23),
Check: resource.ComposeTestCheckFunc(
testAccCheckESDomainExists("aws_elasticsearch_domain.example", &input),
testAccCheckESNumberOfInstances(2, input.ElasticsearchClusterConfig),
testAccCheckESSnapshotHour(24, input.SnapshotOptions),
testAccCheckESNumberOfInstances(2, &input),
testAccCheckESSnapshotHour(24, &input),
),
},
}})
}

func testAccCheckESSnapshotHour(snapshotHour int, conf *elasticsearch.SnapshotOptions) resource.TestCheckFunc {
func testAccCheckESSnapshotHour(snapshotHour int, status *elasticsearch.ElasticsearchDomainStatus) resource.TestCheckFunc {
return func(s *terraform.State) error {
conf := status.SnapshotOptions
if *conf.AutomatedSnapshotStartHour != int64(snapshotHour) {
return fmt.Errorf("Snapshots start hour differ: %d - %d", *conf.AutomatedSnapshotStartHour, snapshotHour)
}
return nil
}
}

func testAccCheckESNumberOfInstances(numberOfInstances int, conf *elasticsearch.ElasticsearchClusterConfig) resource.TestCheckFunc {
func testAccCheckESNumberOfInstances(numberOfInstances int, status *elasticsearch.ElasticsearchDomainStatus) resource.TestCheckFunc {
return func(s *terraform.State) error {
conf := status.ElasticsearchClusterConfig
if *conf.InstanceCount != int64(numberOfInstances) {
return fmt.Errorf("Number of instances differ: %d - %d", *conf.InstanceCount, numberOfInstances)
}
Expand Down

0 comments on commit 700bb88

Please sign in to comment.