Skip to content

Commit

Permalink
Remove sql_log_bin in tests, add Fatals on errors
Browse files Browse the repository at this point in the history
We did not check the errors before, but that makes testing more
difficult.

I am also removing sql_log_bin = 0; we don't strictly need it for
testing and there is a reason why some DBs (like RDS) don't allow it.
  • Loading branch information
petoju committed Feb 9, 2023
1 parent 8a1504a commit e4683ad
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mysql/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,7 @@ func testAccPreCheck(t *testing.T) {
}

raw := map[string]interface{}{
"conn_params": map[string]interface{}{
"sql_log_bin": 0,
},
"conn_params": map[string]interface{}{},
}
err := testAccProvider.Configure(ctx, terraform.NewResourceConfigRaw(raw))
if err != nil {
Expand All @@ -74,11 +72,13 @@ func testAccPreCheckSkipTiDB(t *testing.T) {
ctx := context.Background()
db, err := connectToMySQL(ctx, testAccProvider.Meta().(*MySQLConfiguration))
if err != nil {
t.Fatalf("Cannot connect to DB (SkipTiDB): %v", err)
return
}

currentVersionString, err := serverVersionString(db)
if err != nil {
t.Fatalf("Cannot get DB version string (SkipTiDB): %v", err)
return
}

Expand All @@ -93,11 +93,13 @@ func testAccPreCheckSkipMariaDB(t *testing.T) {
ctx := context.Background()
db, err := connectToMySQL(ctx, testAccProvider.Meta().(*MySQLConfiguration))
if err != nil {
t.Fatalf("Cannot connect to DB (SkipMariaDB): %v", err)
return
}

currentVersionString, err := serverVersionString(db)
if err != nil {
t.Fatalf("Cannot get DB version string (SkipMariaDB): %v", err)
return
}

Expand All @@ -112,11 +114,13 @@ func testAccPreCheckSkipNotTiDB(t *testing.T) {
ctx := context.Background()
db, err := connectToMySQL(ctx, testAccProvider.Meta().(*MySQLConfiguration))
if err != nil {
t.Fatalf("Cannot connect to DB (SkipNotTiDB): %v", err)
return
}

currentVersionString, err := serverVersionString(db)
if err != nil {
t.Fatalf("Cannot get DB version string (SkipNotTiDB): %v", err)
return
}

Expand Down

0 comments on commit e4683ad

Please sign in to comment.