Skip to content

Commit

Permalink
chore: improve test logic
Browse files Browse the repository at this point in the history
  • Loading branch information
cemdorst committed Feb 6, 2023
1 parent 36086ed commit 117a0bb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mysql/resource_rds_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,14 @@ func TestAccResourceRDSConfigChange(t *testing.T) {
},
Check: resource.ComposeTestCheckFunc(
testAccRDSConfigExists(fmt.Sprintf("mysql_rds_config.%s", rName)),
testAccRDSCheck_full(fullResourceName, binlog, targetDelay, binlogUpdated, targetDelayUpdated),
testAccRDSCheck_full(fullResourceName, binlogUpdated, targetDelayUpdated),
),
},
},
})
}

func testAccRDSCheck_full(rn string, binlog, targetDelay, binlogUpdated, targetDelayUpdated int) resource.TestCheckFunc {
func testAccRDSCheck_full(rn string, binlogUpdated, targetDelayUpdated int) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[rn]
if !ok {
Expand Down Expand Up @@ -192,12 +192,12 @@ func testAccRDSCheck_full(rn string, binlog, targetDelay, binlogUpdated, targetD
return fmt.Errorf("failed reading RDS config: %v", err)
}

if binlog_retention_period == binlog {
return fmt.Errorf("binlog retention should NOT be %d. It should be %d", binlog, binlogUpdated)
if binlog_retention_period != binlogUpdated {
return fmt.Errorf("binlog retention should be %d, not %d", binlogUpdated, binlog_retention_period)
}

if replication_target_delay == targetDelay {
return fmt.Errorf("target delay should NOT be %d. It should be %d", targetDelay, targetDelayUpdated)
if replication_target_delay != targetDelayUpdated {
return fmt.Errorf("target delay should be %d, not %d", targetDelayUpdated, replication_target_delay)
}

return nil
Expand Down

0 comments on commit 117a0bb

Please sign in to comment.