Repository: vitessio/vitess
Pull request #11668 (2022-11-08 18:05:29)

Addition of a CI tool to detect dead links in test/config.json
## Description

This Pull Request fixes the issue detailed in https://github.com/vitessio/vitess/issues/11667. It removes the tests in `test/config.json` that no longer exists and adds a go tool to automatically check that there is no dead links. This tool has been added to the CI workflow `Static Code Checks Etc` to automatically prevent the merge of dead links in `test/config.json`.

We most likely need to do a manual backport on all branches.

## Related Issue(s)

- Fixes https://github.com/vitessio/vitess/issues/11667

## Checklist

-   [x] "Backport me!" label has been added if this change should be backported
-   [x] Tests were added or are not required
-   [x] Documentation was added or is not required


vitess-bot[bot]: ### Review Checklist
            
Hello reviewers! :wave: Please follow this checklist when reviewing this Pull Request.

#### General
- [ ] Ensure that the Pull Request has a descriptive title.
- [ ] If this is a change that users need to know about, please apply the `release notes (needs details)` label so that merging is blocked unless the summary release notes document is included.

#### If a new flag is being introduced:
- [ ] Is it really necessary to add this flag?
- [ ] Flag names should be clear and intuitive (as far as possible)
- [ ] Help text should be descriptive.
- [ ] Flag names should use dashes (`-`) as word separators rather than underscores (`_`).

#### If a workflow is added or modified:
- [ ] Each item in `Jobs` should be named in order to mark it as `required`.
- [ ] If the workflow should be required, the maintainer team should be notified.

#### Bug fixes
- [ ] There should be at least one unit or end-to-end test.
- [ ] The Pull Request description should include a link to an issue that describes the bug.

#### Non-trivial changes
- [ ] There should be some code comments as to why things are implemented the way they are.

#### New/Existing features
- [ ] Should be documented, either by modifying the existing documentation or creating new documentation.
- [ ] New features should have a link to a feature request issue or an RFC that documents the use cases, corner cases and test cases.

#### Backward compatibility            
- [ ] Protobuf changes should be wire-compatible.
- [ ] Changes to `_vt` tables and RPCs need to be backward compatible.
- [ ] `vtctl` command output order should be stable and `awk`-able.
- [ ] RPC changes should be compatible with vitess-operator
- [ ] If a flag is removed, then it should also be removed from VTop, if used there.

rsajwani: Still some test failures are there which seems related to this PR.. 
deepthi: > Still some test failures are there which seems related to this PR..

It seems to me that the `derived` test has not been running for some time in CI and is possibly broken for real.
cc @systay 
frouioui: > It seems to me that the derived test has not been running for some time in CI and is possibly broken for real.

Should be fixed now. The clean up code was missing a table, a test was flaky, and a test is now skipped and will be fixed later (https://github.com/vitessio/vitess/issues/11703).

Patch:
diff --git a/.github/workflows/static_checks_etc.yml b/.github/workflows/static_checks_etc.yml
index 3084991410..7a45a54426 100644
--- a/.github/workflows/static_checks_etc.yml
+++ b/.github/workflows/static_checks_etc.yml
@@ -90,7 +90,8 @@ jobs:
               - 'Makefile'
               - 'bootstrap.sh'
               - '.github/workflows/static_checks_etc.yml'
-
+            ci_config:
+              - 'test/config.json'
 
       - name: Set up Go
         if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.go_files == 'true' || steps.changes.outputs.parser_changes == 'true' || steps.changes.outputs.proto_changes == 'true'
@@ -195,3 +196,8 @@ jobs:
         if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.proto_changes == 'true'
         run: |
           tools/check_make_proto.sh || exit 1
+
+      - name: Check test/config.json
+        if: steps.skip-workflow.outputs.skip-workflow == 'false' && (steps.changes.outputs.go_files == 'true' || steps.changes.outputs.ci_config == 'true')
+        run: |
+          go run ./go/tools/ci-config/main.go || exit 1
diff --git a/go.mod b/go.mod
index 97122cfee8..aeafac47ac 100644
--- a/go.mod
+++ b/go.mod
@@ -117,6 +117,7 @@ require (
 
 require (
 	github.com/bndr/gotabulate v1.1.2
+	github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249
 	github.com/openark/golib v0.0.0-20210531070646-355f37940af8
 	golang.org/x/exp v0.0.0-20221023144134-a1e5550cf13e
 )
diff --git a/go.sum b/go.sum
index a0ed58c44d..bcff557d4b 100644
--- a/go.sum
+++ b/go.sum
@@ -128,8 +128,6 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
 github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
 github.com/bndr/gotabulate v1.1.2 h1:yC9izuZEphojb9r+KYL4W9IJKO/ceIO8HDwxMA24U4c=
 github.com/bndr/gotabulate v1.1.2/go.mod h1:0+8yUgaPTtLRTjf49E8oju7ojpU11YmXyvq1LbPAb3U=
-github.com/buger/jsonparser v0.0.0-20200322175846-f7e751efca13 h1:+qUNY4VRkEH46bLUwxCyUU+iOGJMQBVibAaYzWiwWcg=
-github.com/buger/jsonparser v0.0.0-20200322175846-f7e751efca13/go.mod h1:tgcrVJ81GPSF0mz+0nu1Xaz0fazGPrmmJfJtxjbHhUQ=
 github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
 github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -564,6 +562,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
 github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
 github.com/ngdinhtoan/glide-cleanup v0.2.0/go.mod h1:UQzsmiDOb8YV3nOsCxK/c9zPpCZVNoHScRE3EO9pVMM=
+github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249 h1:NHrXEjTNQY7P0Zfx1aMrNhpgxHmow66XQtm0aQLY0AE=
+github.com/nsf/jsondiff v0.0.0-20210926074059-1e845ec5d249/go.mod h1:mpRZBD8SJ55OIICQ3iWH0Yz3cjzA61JdqMLoWXeB2+8=
 github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
 github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
 github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
diff --git a/go/tools/ci-config/main.go b/go/tools/ci-config/main.go
new file mode 100644
index 0000000000..d767b6f4d3
--- /dev/null
+++ b/go/tools/ci-config/main.go
@@ -0,0 +1,74 @@
+/*
+Copyright 2022 The Vitess Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+	"encoding/json"
+	"fmt"
+	"log"
+	"os"
+	"strings"
+)
+
+type Test struct {
+	Args []string
+}
+
+type Config struct {
+	Tests map[string]*Test
+}
+
+func main() {
+	content, err := os.ReadFile("./test/config.json")
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	tests := &Config{}
+	err = json.Unmarshal(content, tests)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	var failedConfig []string
+	for name, test := range tests.Tests {
+		if len(test.Args) == 0 {
+			continue
+		}
+		path := test.Args[0]
+		if !strings.HasPrefix(path, "vitess.io/vitess/") {
+			continue
+		}
+		path = path[len("vitess.io/vitess/"):]
+
+		stat, err := os.Stat(path)
+		if err != nil || !stat.IsDir() {
+			failedConfig = append(failedConfig, fmt.Sprintf("%s: %s", name, path))
+			continue
+		}
+	}
+
+	if len(failedConfig) > 0 {
+		fmt.Println("Some packages in test/config.json were not found in the codebase:")
+		for _, failed := range failedConfig {
+			fmt.Println("\t" + failed)
+		}
+		fmt.Println("\nYou must remove them from test/config.json to avoid unnecessary CI load.")
+		os.Exit(1)
+	}
+	fmt.Println("The file: test/config.json is clean.")
+}


Test patch:
diff --git a/go/mysql/auth_server_clientcert_test.go b/go/mysql/auth_server_clientcert_test.go
index 7cceb1396b..4528ee5dbf 100644
--- a/go/mysql/auth_server_clientcert_test.go
+++ b/go/mysql/auth_server_clientcert_test.go
@@ -24,6 +24,9 @@ import (
 	"reflect"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/vt/tlstest"
 	"vitess.io/vitess/go/vt/vttls"
 )
@@ -43,9 +46,7 @@ func TestValidCert(t *testing.T) {
 
 	// Create the listener, so we can get its host.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -65,9 +66,8 @@ func TestValidCert(t *testing.T) {
 		path.Join(root, "ca-crl.pem"),
 		"",
 		tls.VersionTLS12)
-	if err != nil {
-		t.Fatalf("TLSServerConfig failed: %v", err)
-	}
+	require.NoError(t, err, "TLSServerConfig failed: %v", err)
+
 	l.TLSConfig.Store(serverConfig)
 	go func() {
 		l.Accept()
@@ -89,29 +89,20 @@ func TestValidCert(t *testing.T) {
 
 	ctx := context.Background()
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("Connect failed: %v", err)
-	}
+	require.NoError(t, err, "Connect failed: %v", err)
+
 	defer conn.Close()
 
 	// Make sure this went through SSL.
 	result, err := conn.ExecuteFetch("ssl echo", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
-	if result.Rows[0][0].ToString() != "ON" {
-		t.Errorf("Got wrong result from ExecuteFetch(ssl echo): %v", result)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+	assert.Equal(t, "ON", result.Rows[0][0].ToString(), "Got wrong result from ExecuteFetch(ssl echo): %v", result)
 
 	userData := th.LastConn().UserData.Get()
-	if userData.Username != clientCertUsername {
-		t.Errorf("userdata username is %v, expected %v", userData.Username, clientCertUsername)
-	}
+	assert.Equal(t, clientCertUsername, userData.Username, "userdata username is %v, expected %v", userData.Username, clientCertUsername)
 
 	expectedGroups := []string{"localhost", clientCertUsername}
-	if !reflect.DeepEqual(userData.Groups, expectedGroups) {
-		t.Errorf("userdata groups is %v, expected %v", userData.Groups, expectedGroups)
-	}
+	assert.True(t, reflect.DeepEqual(userData.Groups, expectedGroups), "userdata groups is %v, expected %v", userData.Groups, expectedGroups)
 
 	// Send a ComQuit to avoid the error message on the server side.
 	conn.writeComQuit()
@@ -124,9 +115,7 @@ func TestNoCert(t *testing.T) {
 
 	// Create the listener, so we can get its host.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -145,9 +134,8 @@ func TestNoCert(t *testing.T) {
 		path.Join(root, "ca-crl.pem"),
 		"",
 		tls.VersionTLS12)
-	if err != nil {
-		t.Fatalf("TLSServerConfig failed: %v", err)
-	}
+	require.NoError(t, err, "TLSServerConfig failed: %v", err)
+
 	l.TLSConfig.Store(serverConfig)
 	go func() {
 		l.Accept()
@@ -166,9 +154,8 @@ func TestNoCert(t *testing.T) {
 
 	ctx := context.Background()
 	conn, err := Connect(ctx, params)
-	if err == nil {
-		t.Errorf("Connect() should have errored due to no client cert")
-	}
+	assert.Error(t, err, "Connect() should have errored due to no client cert")
+
 	if conn != nil {
 		conn.Close()
 	}
diff --git a/go/mysql/auth_server_static_flaky_test.go b/go/mysql/auth_server_static_flaky_test.go
index ebbc655dff..52e8fee8ab 100644
--- a/go/mysql/auth_server_static_flaky_test.go
+++ b/go/mysql/auth_server_static_flaky_test.go
@@ -23,6 +23,8 @@ import (
 	"syscall"
 	"testing"
 	"time"
+
+	"github.com/stretchr/testify/require"
 )
 
 // getEntries is a test-only method for AuthServerStatic.
@@ -37,16 +39,10 @@ func TestJsonConfigParser(t *testing.T) {
 	config := make(map[string][]*AuthServerStaticEntry)
 	jsonConfig := "{\"mysql_user\":{\"Password\":\"123\", \"UserData\":\"dummy\"}, \"mysql_user_2\": {\"Password\": \"123\", \"UserData\": \"mysql_user_2\"}}"
 	err := ParseConfig([]byte(jsonConfig), &config)
-	if err != nil {
-		t.Fatalf("should not get an error, but got: %v", err)
-	}
-	if len(config["mysql_user"]) != 1 {
-		t.Fatalf("mysql_user config size should be equal to 1")
-	}
+	require.NoError(t, err, "should not get an error, but got: %v", err)
+	require.Equal(t, 1, len(config["mysql_user"]), "mysql_user config size should be equal to 1")
+	require.Equal(t, 1, len(config["mysql_user_2"]), "mysql_user config size should be equal to 1")
 
-	if len(config["mysql_user_2"]) != 1 {
-		t.Fatalf("mysql_user config size should be equal to 1")
-	}
 	// works with new format
 	jsonConfig = `{"mysql_user":[
 		{"Password":"123", "UserData":"dummy", "SourceHost": "localhost"},
@@ -54,16 +50,9 @@ func TestJsonConfigParser(t *testing.T) {
 		{"Password": "456", "UserData": "mysql_user_with_groups", "Groups": ["user_group"]}
 	]}`
 	err = ParseConfig([]byte(jsonConfig), &config)
-	if err != nil {
-		t.Fatalf("should not get an error, but got: %v", err)
-	}
-	if len(config["mysql_user"]) != 3 {
-		t.Fatalf("mysql_user config size should be equal to 3")
-	}
-
-	if config["mysql_user"][0].SourceHost != "localhost" {
-		t.Fatalf("SourceHost should be equal to localhost")
-	}
+	require.NoError(t, err, "should not get an error, but got: %v", err)
+	require.Equal(t, 3, len(config["mysql_user"]), "mysql_user config size should be equal to 3")
+	require.Equal(t, "localhost", config["mysql_user"][0].SourceHost, "SourceHost should be equal to localhost")
 
 	if len(config["mysql_user"][2].Groups) != 1 || config["mysql_user"][2].Groups[0] != "user_group" {
 		t.Fatalf("Groups should be equal to [\"user_group\"]")
@@ -73,9 +62,8 @@ func TestJsonConfigParser(t *testing.T) {
 		"mysql_user": [{"Password": "123", "UserData": "mysql_user_all", "InvalidKey": "oops"}]
 	}`
 	err = ParseConfig([]byte(jsonConfig), &config)
-	if err == nil {
-		t.Fatalf("Invalid config should have errored, but didn't")
-	}
+	require.Error(t, err, "Invalid config should have errored, but didn't")
+
 }
 
 func TestValidateHashGetter(t *testing.T) {
@@ -87,20 +75,15 @@ func TestValidateHashGetter(t *testing.T) {
 	addr := &net.IPAddr{IP: ip, Zone: ""}
 
 	salt, err := newSalt()
-	if err != nil {
-		t.Fatalf("error generating salt: %v", err)
-	}
+	require.NoError(t, err, "error generating salt: %v", err)
 
 	scrambled := ScrambleMysqlNativePassword(salt, []byte("password"))
 	getter, err := auth.UserEntryWithHash(nil, salt, "mysql_user", scrambled, addr)
-	if err != nil {
-		t.Fatalf("error validating password: %v", err)
-	}
+	require.NoError(t, err, "error validating password: %v", err)
 
 	callerID := getter.Get()
-	if callerID.Username != "user.name" {
-		t.Fatalf("getter username incorrect, expected \"user.name\", got %v", callerID.Username)
-	}
+	require.Equal(t, "user.name", callerID.Username, "getter username incorrect, expected \"user.name\", got %v", callerID.Username)
+
 	if len(callerID.Groups) != 1 || callerID.Groups[0] != "user_group" {
 		t.Fatalf("getter groups incorrect, expected [\"user_group\"], got %v", callerID.Groups)
 	}
@@ -110,27 +93,21 @@ func TestHostMatcher(t *testing.T) {
 	ip := net.ParseIP("192.168.0.1")
 	addr := &net.TCPAddr{IP: ip, Port: 9999}
 	match := MatchSourceHost(net.Addr(addr), "")
-	if !match {
-		t.Fatalf("Should match any address when target is empty")
-	}
+	require.True(t, match, "Should match any address when target is empty")
 
 	match = MatchSourceHost(net.Addr(addr), "localhost")
-	if match {
-		t.Fatalf("Should not match address when target is localhost")
-	}
+	require.False(t, match, "Should not match address when target is localhost")
 
 	socket := &net.UnixAddr{Name: "unixSocket", Net: "1"}
 	match = MatchSourceHost(net.Addr(socket), "localhost")
-	if !match {
-		t.Fatalf("Should match socket when target is localhost")
-	}
+	require.True(t, match, "Should match socket when target is localhost")
+
 }
 
 func TestStaticConfigHUP(t *testing.T) {
 	tmpFile, err := os.CreateTemp("", "mysql_auth_server_static_file.json")
-	if err != nil {
-		t.Fatalf("couldn't create temp file: %v", err)
-	}
+	require.NoError(t, err, "couldn't create temp file: %v", err)
+
 	defer os.Remove(tmpFile.Name())
 
 	oldStr := "str5"
@@ -141,10 +118,7 @@ func TestStaticConfigHUP(t *testing.T) {
 
 	aStatic := NewAuthServerStatic(tmpFile.Name(), "", 0)
 	defer aStatic.close()
-
-	if aStatic.getEntries()[oldStr][0].Password != oldStr {
-		t.Fatalf("%s's Password should still be '%s'", oldStr, oldStr)
-	}
+	require.Equal(t, oldStr, aStatic.getEntries()[oldStr][0].Password, "%s's Password should still be '%s'", oldStr, oldStr)
 
 	hupTest(t, aStatic, tmpFile, oldStr, "str2")
 	hupTest(t, aStatic, tmpFile, "str2", "str3") // still handling the signal
@@ -159,9 +133,8 @@ func TestStaticConfigHUP(t *testing.T) {
 
 func TestStaticConfigHUPWithRotation(t *testing.T) {
 	tmpFile, err := os.CreateTemp("", "mysql_auth_server_static_file.json")
-	if err != nil {
-		t.Fatalf("couldn't create temp file: %v", err)
-	}
+	require.NoError(t, err, "couldn't create temp file: %v", err)
+
 	defer os.Remove(tmpFile.Name())
 
 	oldStr := "str1"
@@ -172,10 +145,7 @@ func TestStaticConfigHUPWithRotation(t *testing.T) {
 
 	aStatic := NewAuthServerStatic(tmpFile.Name(), "", 10*time.Millisecond)
 	defer aStatic.close()
-
-	if aStatic.getEntries()[oldStr][0].Password != oldStr {
-		t.Fatalf("%s's Password should still be '%s'", oldStr, oldStr)
-	}
+	require.Equal(t, oldStr, aStatic.getEntries()[oldStr][0].Password, "%s's Password should still be '%s'", oldStr, oldStr)
 
 	hupTestWithRotation(t, aStatic, tmpFile, oldStr, "str4")
 	hupTestWithRotation(t, aStatic, tmpFile, "str4", "str5")
@@ -186,20 +156,14 @@ func hupTest(t *testing.T, aStatic *AuthServerStatic, tmpFile *os.File, oldStr,
 	if err := os.WriteFile(tmpFile.Name(), []byte(jsonConfig), 0600); err != nil {
 		t.Fatalf("couldn't overwrite temp file: %v", err)
 	}
-
-	if aStatic.getEntries()[oldStr][0].Password != oldStr {
-		t.Fatalf("%s's Password should still be '%s'", oldStr, oldStr)
-	}
+	require.Equal(t, oldStr, aStatic.getEntries()[oldStr][0].Password, "%s's Password should still be '%s'", oldStr, oldStr)
 
 	syscall.Kill(syscall.Getpid(), syscall.SIGHUP)
-	time.Sleep(100 * time.Millisecond) // wait for signal handler
+	time.Sleep(100 * time.Millisecond)
+	// wait for signal handler
+	require.Nil(t, aStatic.getEntries()[oldStr], "Should not have old %s after config reload", oldStr)
+	require.Equal(t, newStr, aStatic.getEntries()[newStr][0].Password, "%s's Password should be '%s'", newStr, newStr)
 
-	if aStatic.getEntries()[oldStr] != nil {
-		t.Fatalf("Should not have old %s after config reload", oldStr)
-	}
-	if aStatic.getEntries()[newStr][0].Password != newStr {
-		t.Fatalf("%s's Password should be '%s'", newStr, newStr)
-	}
 }
 
 func hupTestWithRotation(t *testing.T, aStatic *AuthServerStatic, tmpFile *os.File, oldStr, newStr string) {
@@ -208,14 +172,11 @@ func hupTestWithRotation(t *testing.T, aStatic *AuthServerStatic, tmpFile *os.Fi
 		t.Fatalf("couldn't overwrite temp file: %v", err)
 	}
 
-	time.Sleep(20 * time.Millisecond) // wait for signal handler
+	time.Sleep(20 * time.Millisecond)
+	// wait for signal handler
+	require.Nil(t, aStatic.getEntries()[oldStr], "Should not have old %s after config reload", oldStr)
+	require.Equal(t, newStr, aStatic.getEntries()[newStr][0].Password, "%s's Password should be '%s'", newStr, newStr)
 
-	if aStatic.getEntries()[oldStr] != nil {
-		t.Fatalf("Should not have old %s after config reload", oldStr)
-	}
-	if aStatic.getEntries()[newStr][0].Password != newStr {
-		t.Fatalf("%s's Password should be '%s'", newStr, newStr)
-	}
 }
 
 func TestStaticPasswords(t *testing.T) {
@@ -267,21 +228,17 @@ func TestStaticPasswords(t *testing.T) {
 	for _, c := range tests {
 		t.Run(fmt.Sprintf("%s-%s", c.user, c.password), func(t *testing.T) {
 			salt, err := newSalt()
-			if err != nil {
-				t.Fatalf("error generating salt: %v", err)
-			}
+			require.NoError(t, err, "error generating salt: %v", err)
 
 			scrambled := ScrambleMysqlNativePassword(salt, []byte(c.password))
 			_, err = auth.UserEntryWithHash(nil, salt, c.user, scrambled, addr)
 
 			if c.success {
-				if err != nil {
-					t.Fatalf("authentication should have succeeded: %v", err)
-				}
+				require.NoError(t, err, "authentication should have succeeded: %v", err)
+
 			} else {
-				if err == nil {
-					t.Fatalf("authentication should have failed")
-				}
+				require.Error(t, err, "authentication should have failed")
+
 			}
 		})
 	}
diff --git a/go/mysql/binlog_event_common_test.go b/go/mysql/binlog_event_common_test.go
index 18ea3f70b5..48847737ec 100644
--- a/go/mysql/binlog_event_common_test.go
+++ b/go/mysql/binlog_event_common_test.go
@@ -199,12 +199,9 @@ func TestBinlogEventFormat(t *testing.T) {
 		HeaderSizes:   googleFormatEvent[76 : len(googleFormatEvent)-5],
 	}
 	got, err := input.Format()
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.Format() = %v, want %v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.Format() = %v, want %v", input, got, want)
+
 }
 
 func TestBinlogEventFormatWrongVersion(t *testing.T) {
@@ -263,9 +260,8 @@ primary key(eid, id)
 		t.Errorf("unexpected error: %v", err)
 		return
 	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.Query() = %v, want %v", input, got, want)
-	}
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.Query() = %v, want %v", input, got, want)
+
 }
 
 func TestBinlogEventQueryBadLength(t *testing.T) {
diff --git a/go/mysql/binlog_event_make_test.go b/go/mysql/binlog_event_make_test.go
index ef30fc5937..7374f9180e 100644
--- a/go/mysql/binlog_event_make_test.go
+++ b/go/mysql/binlog_event_make_test.go
@@ -20,6 +20,8 @@ import (
 	"reflect"
 	"testing"
 
+	"github.com/stretchr/testify/require"
+
 	binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
 )
 
@@ -31,38 +33,25 @@ func TestFormatDescriptionEvent(t *testing.T) {
 	s := NewFakeBinlogStream()
 
 	event := NewFormatDescriptionEvent(f, s)
-	if !event.IsValid() {
-		t.Fatalf("IsValid() returned false")
-	}
-	if !event.IsFormatDescription() {
-		t.Fatalf("IsFormatDescription returned false")
-	}
+	require.True(t, event.IsValid(), "IsValid() returned false")
+	require.True(t, event.IsFormatDescription(), "IsFormatDescription returned false")
+
 	gotF, err := event.Format()
-	if err != nil {
-		t.Fatalf("Format failed: %v", err)
-	}
-	if !reflect.DeepEqual(gotF, f) {
-		t.Fatalf("Parsed BinlogFormat doesn't match, got:\n%v\nexpected:\n%v", gotF, f)
-	}
+	require.NoError(t, err, "Format failed: %v", err)
+	require.True(t, reflect.DeepEqual(gotF, f), "Parsed BinlogFormat doesn't match, got:\n%v\nexpected:\n%v", gotF, f)
 
 	// MariaDB
 	f = NewMariaDBBinlogFormat()
 	s = NewFakeBinlogStream()
 
 	event = NewFormatDescriptionEvent(f, s)
-	if !event.IsValid() {
-		t.Fatalf("IsValid() returned false")
-	}
-	if !event.IsFormatDescription() {
-		t.Fatalf("IsFormatDescription returned false")
-	}
+	require.True(t, event.IsValid(), "IsValid() returned false")
+	require.True(t, event.IsFormatDescription(), "IsFormatDescription returned false")
+
 	gotF, err = event.Format()
-	if err != nil {
-		t.Fatalf("Format failed: %v", err)
-	}
-	if !reflect.DeepEqual(gotF, f) {
-		t.Fatalf("Parsed BinlogFormat doesn't match, got:\n%v\nexpected:\n%v", gotF, f)
-	}
+	require.NoError(t, err, "Format failed: %v", err)
+	require.True(t, reflect.DeepEqual(gotF, f), "Parsed BinlogFormat doesn't match, got:\n%v\nexpected:\n%v", gotF, f)
+
 }
 
 func TestQueryEvent(t *testing.T) {
@@ -79,24 +68,16 @@ func TestQueryEvent(t *testing.T) {
 		},
 	}
 	event := NewQueryEvent(f, s, q)
-	if !event.IsValid() {
-		t.Fatalf("NewQueryEvent returned an invalid event")
-	}
-	if !event.IsQuery() {
-		t.Fatalf("NewQueryEvent returned a non-query event: %v", event)
-	}
+	require.True(t, event.IsValid(), "NewQueryEvent returned an invalid event")
+	require.True(t, event.IsQuery(), "NewQueryEvent returned a non-query event: %v", event)
+
 	event, _, err := event.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("StripChecksum failed: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum failed: %v", err)
 
 	gotQ, err := event.Query(f)
-	if err != nil {
-		t.Fatalf("event.Query() failed: %v", err)
-	}
-	if !reflect.DeepEqual(gotQ, q) {
-		t.Fatalf("event.Query() returned %v was expecting %v", gotQ, q)
-	}
+	require.NoError(t, err, "event.Query() failed: %v", err)
+	require.True(t, reflect.DeepEqual(gotQ, q), "event.Query() returned %v was expecting %v", gotQ, q)
+
 }
 
 func TestXIDEvent(t *testing.T) {
@@ -104,12 +85,9 @@ func TestXIDEvent(t *testing.T) {
 	s := NewFakeBinlogStream()
 
 	event := NewXIDEvent(f, s)
-	if !event.IsValid() {
-		t.Fatalf("NewXIDEvent().IsValid() is false")
-	}
-	if !event.IsXID() {
-		t.Fatalf("NewXIDEvent().IsXID() is false")
-	}
+	require.True(t, event.IsValid(), "NewXIDEvent().IsValid() is false")
+	require.True(t, event.IsXID(), "NewXIDEvent().IsXID() is false")
+
 }
 
 func TestIntVarEvent(t *testing.T) {
@@ -117,28 +95,21 @@ func TestIntVarEvent(t *testing.T) {
 	s := NewFakeBinlogStream()
 
 	event := NewIntVarEvent(f, s, IntVarLastInsertID, 0x123456789abcdef0)
-	if !event.IsValid() {
-		t.Fatalf("NewIntVarEvent().IsValid() is false")
-	}
-	if !event.IsIntVar() {
-		t.Fatalf("NewIntVarEvent().IsIntVar() is false")
-	}
+	require.True(t, event.IsValid(), "NewIntVarEvent().IsValid() is false")
+	require.True(t, event.IsIntVar(), "NewIntVarEvent().IsIntVar() is false")
+
 	name, value, err := event.IntVar(f)
 	if name != IntVarLastInsertID || value != 0x123456789abcdef0 || err != nil {
 		t.Fatalf("IntVar() returned %v/%v/%v", name, value, err)
 	}
 
 	event = NewIntVarEvent(f, s, IntVarInvalidInt, 0x123456789abcdef0)
-	if !event.IsValid() {
-		t.Fatalf("NewIntVarEvent().IsValid() is false")
-	}
-	if !event.IsIntVar() {
-		t.Fatalf("NewIntVarEvent().IsIntVar() is false")
-	}
+	require.True(t, event.IsValid(), "NewIntVarEvent().IsValid() is false")
+	require.True(t, event.IsIntVar(), "NewIntVarEvent().IsIntVar() is false")
+
 	name, value, err = event.IntVar(f)
-	if err == nil {
-		t.Fatalf("IntVar(invalid) returned %v/%v/%v", name, value, err)
-	}
+	require.Error(t, err, "IntVar(invalid) returned %v/%v/%v", name, value, err)
+
 }
 
 func TestInvalidEvents(t *testing.T) {
@@ -153,24 +124,18 @@ func TestInvalidEvents(t *testing.T) {
 
 	// InvalidFormatDescriptionEvent
 	event = NewInvalidFormatDescriptionEvent(f, s)
-	if !event.IsValid() {
-		t.Fatalf("NewInvalidFormatDescriptionEvent().IsValid() is false")
-	}
-	if !event.IsFormatDescription() {
-		t.Fatalf("NewInvalidFormatDescriptionEvent().IsFormatDescription() is false")
-	}
+	require.True(t, event.IsValid(), "NewInvalidFormatDescriptionEvent().IsValid() is false")
+	require.True(t, event.IsFormatDescription(), "NewInvalidFormatDescriptionEvent().IsFormatDescription() is false")
+
 	if _, err := event.Format(); err == nil {
 		t.Fatalf("NewInvalidFormatDescriptionEvent().Format() returned err=nil")
 	}
 
 	// InvalidQueryEvent
 	event = NewInvalidQueryEvent(f, s)
-	if !event.IsValid() {
-		t.Fatalf("NewInvalidQueryEvent().IsValid() is false")
-	}
-	if !event.IsQuery() {
-		t.Fatalf("NewInvalidQueryEvent().IsQuery() is false")
-	}
+	require.True(t, event.IsValid(), "NewInvalidQueryEvent().IsValid() is false")
+	require.True(t, event.IsQuery(), "NewInvalidQueryEvent().IsQuery() is false")
+
 	if _, err := event.Query(f); err == nil {
 		t.Fatalf("NewInvalidQueryEvent().Query() returned err=nil")
 	}
@@ -183,56 +148,38 @@ func TestMariadDBGTIDEVent(t *testing.T) {
 
 	// With built-in begin.
 	event := NewMariaDBGTIDEvent(f, s, MariadbGTID{Domain: 0, Sequence: 0x123456789abcdef0}, true)
-	if !event.IsValid() {
-		t.Fatalf("NewMariaDBGTIDEvent().IsValid() is false")
-	}
-	if !event.IsGTID() {
-		t.Fatalf("NewMariaDBGTIDEvent().IsGTID() if false")
-	}
+	require.True(t, event.IsValid(), "NewMariaDBGTIDEvent().IsValid() is false")
+	require.True(t, event.IsGTID(), "NewMariaDBGTIDEvent().IsGTID() if false")
+
 	event, _, err := event.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("StripChecksum failed: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum failed: %v", err)
 
 	gtid, hasBegin, err := event.GTID(f)
-	if err != nil {
-		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned error: %v", err)
-	}
-	if !hasBegin {
-		t.Fatalf("NewMariaDBGTIDEvent() didn't store hasBegin properly.")
-	}
+	require.NoError(t, err, "NewMariaDBGTIDEvent().GTID() returned error: %v", err)
+	require.True(t, hasBegin, "NewMariaDBGTIDEvent() didn't store hasBegin properly.")
+
 	mgtid, ok := gtid.(MariadbGTID)
-	if !ok {
-		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned a non-MariaDBGTID GTID")
-	}
+	require.True(t, ok, "NewMariaDBGTIDEvent().GTID() returned a non-MariaDBGTID GTID")
+
 	if mgtid.Domain != 0 || mgtid.Server != 0x87654321 || mgtid.Sequence != 0x123456789abcdef0 {
 		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned invalid GITD: %v", mgtid)
 	}
 
 	// Without built-in begin.
 	event = NewMariaDBGTIDEvent(f, s, MariadbGTID{Domain: 0, Sequence: 0x123456789abcdef0}, false)
-	if !event.IsValid() {
-		t.Fatalf("NewMariaDBGTIDEvent().IsValid() is false")
-	}
-	if !event.IsGTID() {
-		t.Fatalf("NewMariaDBGTIDEvent().IsGTID() if false")
-	}
+	require.True(t, event.IsValid(), "NewMariaDBGTIDEvent().IsValid() is false")
+	require.True(t, event.IsGTID(), "NewMariaDBGTIDEvent().IsGTID() if false")
+
 	event, _, err = event.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("StripChecksum failed: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum failed: %v", err)
 
 	gtid, hasBegin, err = event.GTID(f)
-	if err != nil {
-		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned error: %v", err)
-	}
-	if hasBegin {
-		t.Fatalf("NewMariaDBGTIDEvent() didn't store hasBegin properly.")
-	}
+	require.NoError(t, err, "NewMariaDBGTIDEvent().GTID() returned error: %v", err)
+	require.False(t, hasBegin, "NewMariaDBGTIDEvent() didn't store hasBegin properly.")
+
 	mgtid, ok = gtid.(MariadbGTID)
-	if !ok {
-		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned a non-MariaDBGTID GTID")
-	}
+	require.True(t, ok, "NewMariaDBGTIDEvent().GTID() returned a non-MariaDBGTID GTID")
+
 	if mgtid.Domain != 0 || mgtid.Server != 0x87654321 || mgtid.Sequence != 0x123456789abcdef0 {
 		t.Fatalf("NewMariaDBGTIDEvent().GTID() returned invalid GITD: %v", mgtid)
 	}
@@ -278,29 +225,19 @@ func TestTableMapEvent(t *testing.T) {
 	tm.CanBeNull.Set(9, true)
 
 	event := NewTableMapEvent(f, s, 0x102030405060, tm)
-	if !event.IsValid() {
-		t.Fatalf("NewTableMapEvent().IsValid() is false")
-	}
-	if !event.IsTableMap() {
-		t.Fatalf("NewTableMapEvent().IsTableMap() if false")
-	}
+	require.True(t, event.IsValid(), "NewTableMapEvent().IsValid() is false")
+	require.True(t, event.IsTableMap(), "NewTableMapEvent().IsTableMap() if false")
 
 	event, _, err := event.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("StripChecksum failed: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum failed: %v", err)
 
 	tableID := event.TableID(f)
-	if tableID != 0x102030405060 {
-		t.Fatalf("NewTableMapEvent().ID returned %x", tableID)
-	}
+	require.Equal(t, uint64(0x102030405060), tableID, "NewTableMapEvent().ID returned %x", tableID)
+
 	gotTm, err := event.TableMap(f)
-	if err != nil {
-		t.Fatalf("NewTableMapEvent().TableMapEvent() returned error: %v", err)
-	}
-	if !reflect.DeepEqual(gotTm, tm) {
-		t.Fatalf("NewTableMapEvent().TableMapEvent() got TableMap:\n%v\nexpected:\n%v", gotTm, tm)
-	}
+	require.NoError(t, err, "NewTableMapEvent().TableMapEvent() returned error: %v", err)
+	require.True(t, reflect.DeepEqual(gotTm, tm), "NewTableMapEvent().TableMapEvent() got TableMap:\n%v\nexpected:\n%v", gotTm, tm)
+
 }
 
 func TestRowsEvent(t *testing.T) {
@@ -374,27 +311,17 @@ func TestRowsEvent(t *testing.T) {
 	}
 
 	event := NewUpdateRowsEvent(f, s, 0x102030405060, rows)
-	if !event.IsValid() {
-		t.Fatalf("NewRowsEvent().IsValid() is false")
-	}
-	if !event.IsUpdateRows() {
-		t.Fatalf("NewRowsEvent().IsUpdateRows() if false")
-	}
+	require.True(t, event.IsValid(), "NewRowsEvent().IsValid() is false")
+	require.True(t, event.IsUpdateRows(), "NewRowsEvent().IsUpdateRows() if false")
 
 	event, _, err := event.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("StripChecksum failed: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum failed: %v", err)
 
 	tableID = event.TableID(f)
-	if tableID != 0x102030405060 {
-		t.Fatalf("NewRowsEvent().ID returned %x", tableID)
-	}
+	require.Equal(t, uint64(0x102030405060), tableID, "NewRowsEvent().ID returned %x", tableID)
+
 	gotRows, err := event.Rows(f, tm)
-	if err != nil {
-		t.Fatalf("NewRowsEvent().Rows() returned error: %v", err)
-	}
-	if !reflect.DeepEqual(gotRows, rows) {
-		t.Fatalf("NewRowsEvent().Rows() got Rows:\n%v\nexpected:\n%v", gotRows, rows)
-	}
+	require.NoError(t, err, "NewRowsEvent().Rows() returned error: %v", err)
+	require.True(t, reflect.DeepEqual(gotRows, rows), "NewRowsEvent().Rows() got Rows:\n%v\nexpected:\n%v", gotRows, rows)
+
 }
diff --git a/go/mysql/binlog_event_mariadb_test.go b/go/mysql/binlog_event_mariadb_test.go
index 1b564f5d6e..1464da0e57 100644
--- a/go/mysql/binlog_event_mariadb_test.go
+++ b/go/mysql/binlog_event_mariadb_test.go
@@ -21,6 +21,7 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 // sample event data
@@ -100,15 +101,10 @@ func TestMariadbStandaloneBinlogEventGTID(t *testing.T) {
 	input := mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbStandaloneGTIDEvent)}
 	want := MariadbGTID{Domain: 0, Server: 62344, Sequence: 9}
 	got, hasBegin, err := input.GTID(f)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if hasBegin {
-		t.Errorf("unexpected hasBegin")
-	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.GTID() = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.False(t, hasBegin, "unexpected hasBegin")
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.GTID() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariadbBinlogEventGTID(t *testing.T) {
@@ -121,15 +117,10 @@ func TestMariadbBinlogEventGTID(t *testing.T) {
 	input := mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbBeginGTIDEvent)}
 	want := MariadbGTID{Domain: 0, Server: 62344, Sequence: 10}
 	got, hasBegin, err := input.GTID(f)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !hasBegin {
-		t.Errorf("unexpected !hasBegin")
-	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.GTID() = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, hasBegin, "unexpected !hasBegin")
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.GTID() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariadbBinlogEventFormat(t *testing.T) {
@@ -142,12 +133,9 @@ func TestMariadbBinlogEventFormat(t *testing.T) {
 		HeaderSizes:       mariadbFormatEvent[76 : len(mariadbFormatEvent)-5],
 	}
 	got, err := input.Format()
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.Format() = %v, want %v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.Format() = %v, want %v", input, got, want)
+
 }
 
 func TestMariadbBinlogEventChecksumFormat(t *testing.T) {
@@ -160,27 +148,21 @@ func TestMariadbBinlogEventChecksumFormat(t *testing.T) {
 		HeaderSizes:       mariadbChecksumFormatEvent[76 : len(mariadbChecksumFormatEvent)-5],
 	}
 	got, err := input.Format()
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.Format() = %v, want %v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.Format() = %v, want %v", input, got, want)
+
 }
 
 func TestMariadbBinlogEventStripChecksum(t *testing.T) {
 	f, err := (mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbChecksumFormatEvent)}).Format()
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
 
 	input := mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbChecksumQueryEvent)}
 	wantEvent := mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbChecksumStrippedQueryEvent)}
 	wantChecksum := []byte{0xce, 0x49, 0x7a, 0x53}
 	gotEvent, gotChecksum, err := input.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
+
 	if !reflect.DeepEqual(gotEvent, wantEvent) || !reflect.DeepEqual(gotChecksum, wantChecksum) {
 		t.Errorf("%#v.StripChecksum() = (%v, %v), want (%v, %v)", input, gotEvent, gotChecksum, wantEvent, wantChecksum)
 	}
@@ -188,16 +170,13 @@ func TestMariadbBinlogEventStripChecksum(t *testing.T) {
 
 func TestMariadbBinlogEventStripChecksumNone(t *testing.T) {
 	f, err := (mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbFormatEvent)}).Format()
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
 
 	input := mariadbBinlogEvent{binlogEvent: binlogEvent(mariadbStandaloneGTIDEvent)}
 	want := input
 	gotEvent, gotChecksum, err := input.StripChecksum(f)
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
+
 	if !reflect.DeepEqual(gotEvent, want) || gotChecksum != nil {
 		t.Errorf("%#v.StripChecksum() = (%v, %v), want (%v, nil)", input, gotEvent, gotChecksum, want)
 	}
diff --git a/go/mysql/binlog_event_mysql56_test.go b/go/mysql/binlog_event_mysql56_test.go
index a1373bdfed..d1cb16499e 100644
--- a/go/mysql/binlog_event_mysql56_test.go
+++ b/go/mysql/binlog_event_mysql56_test.go
@@ -21,6 +21,7 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 // Sample event data for MySQL 5.6.
@@ -46,14 +47,10 @@ func TestMysql56IsGTID(t *testing.T) {
 
 func TestMysql56StripChecksum(t *testing.T) {
 	format, err := mysql56FormatEvent.Format()
-	if err != nil {
-		t.Fatalf("Format() error: %v", err)
-	}
+	require.NoError(t, err, "Format() error: %v", err)
 
 	stripped, gotChecksum, err := mysql56QueryEvent.StripChecksum(format)
-	if err != nil {
-		t.Fatalf("StripChecksum() error: %v", err)
-	}
+	require.NoError(t, err, "StripChecksum() error: %v", err)
 
 	// Check checksum.
 	if want := []byte{0x92, 0x12, 0x79, 0xc3}; !reflect.DeepEqual(gotChecksum, want) {
@@ -64,9 +61,8 @@ func TestMysql56StripChecksum(t *testing.T) {
 	// Query length is defined as "the rest of the bytes after offset X",
 	// so the query will be wrong if the checksum is not stripped.
 	gotQuery, err := stripped.Query(format)
-	if err != nil {
-		t.Fatalf("Query() error: %v", err)
-	}
+	require.NoError(t, err, "Query() error: %v", err)
+
 	if want := "insert into test_table (msg) values ('hello')"; string(gotQuery.SQL) != want {
 		t.Errorf("query = %#v, want %#v", string(gotQuery.SQL), want)
 	}
@@ -74,28 +70,18 @@ func TestMysql56StripChecksum(t *testing.T) {
 
 func TestMysql56GTID(t *testing.T) {
 	format, err := mysql56FormatEvent.Format()
-	if err != nil {
-		t.Fatalf("Format() error: %v", err)
-	}
+	require.NoError(t, err, "Format() error: %v", err)
+
 	input, _, err := mysql56GTIDEvent.StripChecksum(format)
-	if err != nil {
-		t.Fatalf("StripChecksum() error: %v", err)
-	}
-	if !input.IsGTID() {
-		t.Fatalf("IsGTID() = false, want true")
-	}
+	require.NoError(t, err, "StripChecksum() error: %v", err)
+	require.True(t, input.IsGTID(), "IsGTID() = false, want true")
 
 	want, _ := parseMysql56GTID("439192bd-f37c-11e4-bbeb-0242ac11035a:4")
 	got, hasBegin, err := input.GTID(format)
-	if err != nil {
-		t.Fatalf("GTID() error: %v", err)
-	}
-	if hasBegin {
-		t.Errorf("GTID() returned hasBegin")
-	}
-	if got != want {
-		t.Errorf("GTID() = %#v, want %#v", got, want)
-	}
+	require.NoError(t, err, "GTID() error: %v", err)
+	assert.False(t, hasBegin, "GTID() returned hasBegin")
+	assert.Equal(t, want, got, "GTID() = %#v, want %#v", got, want)
+
 }
 
 func TestMysql56ParseGTID(t *testing.T) {
@@ -106,12 +92,9 @@ func TestMysql56ParseGTID(t *testing.T) {
 	}
 
 	got, err := parseMysql56GTID(input)
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("(&mysql56{}).ParseGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "(&mysql56{}).ParseGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestMysql56ParsePosition(t *testing.T) {
@@ -124,12 +107,9 @@ func TestMysql56ParsePosition(t *testing.T) {
 	want := Position{GTIDSet: set}
 
 	got, err := ParsePosition(Mysql56FlavorID, input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("(&mysql56{}).ParsePosition(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "(&mysql56{}).ParsePosition(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestMysql56SemiSyncAck(t *testing.T) {
diff --git a/go/mysql/binlog_event_test.go b/go/mysql/binlog_event_test.go
index af27639693..c45b8285a8 100644
--- a/go/mysql/binlog_event_test.go
+++ b/go/mysql/binlog_event_test.go
@@ -20,6 +20,8 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+
 	binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
 )
 
@@ -35,9 +37,8 @@ func TestQueryString(t *testing.T) {
 	}
 	want := `{Database: "test_database", Charset:`
 	got := input.String()
-	if !strings.HasPrefix(got, want) {
-		t.Errorf("%#v.String() = %#v, want %#v", input, got, want)
-	}
+	assert.True(t, strings.HasPrefix(got, want), "%#v.String() = %#v, want %#v", input, got, want)
+
 }
 
 func TestQueryStringNilCharset(t *testing.T) {
diff --git a/go/mysql/collations/golden_test.go b/go/mysql/collations/golden_test.go
index 9d38e690da..57321e4818 100644
--- a/go/mysql/collations/golden_test.go
+++ b/go/mysql/collations/golden_test.go
@@ -25,6 +25,9 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 	"vitess.io/vitess/go/mysql/collations/internal/testutil"
 )
@@ -52,10 +55,8 @@ func TestGoldenWeights(t *testing.T) {
 					}
 
 					result := coll.WeightString(nil, input, 0)
-					if !bytes.Equal(expected, result) {
-						t.Errorf("mismatch for collation=%s\noriginal: %s\ninput:    %#v\nexpected: %v\nactual:   %v",
-							coll.Name(), string(goldenCase.Text), input, expected, result)
-					}
+					assert.True(t, bytes.Equal(expected, result), "mismatch for collation=%s\noriginal: %s\ninput:    %#v\nexpected: %v\nactual:   %v", coll.Name(), string(goldenCase.Text), input, expected, result)
+
 				}
 			})
 		}
@@ -78,9 +79,8 @@ func TestCollationsForLanguage(t *testing.T) {
 	}
 
 	for lang := range testutil.KnownLanguages {
-		if len(langCounts[lang]) == 0 {
-			t.Errorf("no collations found for %q", lang)
-		}
+		assert.NotEqual(t, 0, len(langCounts[lang]), "no collations found for %q", lang)
+
 		t.Logf("%s: %v", lang, langCounts[lang])
 	}
 }
@@ -191,12 +191,9 @@ func TestAllCollationsByCharset(t *testing.T) {
 					// this doesn't work yet
 					continue
 				}
-				if cset.Default == nil {
-					t.Fatalf("charset %s has no default", csname)
-				}
-				if cset.Binary == nil {
-					t.Fatalf("charset %s has no binary", csname)
-				}
+				require.NotNil(t, cset.Default, "charset %s has no default", csname)
+				require.NotNil(t, cset.Binary, "charset %s has no binary", csname)
+
 			}
 
 			for charset, expected := range tc.defaults {
diff --git a/go/mysql/collations/integration/charset_test.go b/go/mysql/collations/integration/charset_test.go
index 2384e4b307..96ce9dab0a 100644
--- a/go/mysql/collations/integration/charset_test.go
+++ b/go/mysql/collations/integration/charset_test.go
@@ -21,6 +21,8 @@ import (
 	"testing"
 	"unicode/utf8"
 
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/mysql/collations"
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 	"vitess.io/vitess/go/mysql/collations/remote"
@@ -85,9 +87,8 @@ func TestCJKStress(t *testing.T) {
 				t.Helper()
 				ours, _ := charset.ConvertFromUTF8(nil, local, block)
 				theirs, err := charset.ConvertFromUTF8(nil, remote, block)
-				if err != nil {
-					t.Fatalf("remote transcoding failed: %v", err)
-				}
+				require.NoError(t, err, "remote transcoding failed: %v", err)
+
 				return ours, theirs
 			}
 
@@ -95,9 +96,8 @@ func TestCJKStress(t *testing.T) {
 				t.Helper()
 				ours, _ := charset.Convert(nil, charset.Charset_utf8mb4{}, block, local)
 				theirs, err := charset.Convert(nil, remoteUtf8mb4, block, remote)
-				if err != nil {
-					t.Fatalf("remote transcoding failed: %v", err)
-				}
+				require.NoError(t, err, "remote transcoding failed: %v", err)
+
 				return ours, theirs
 			}
 
@@ -111,11 +111,8 @@ func TestCJKStress(t *testing.T) {
 					for _, cp := range string(block) {
 						input := string(cp)
 						ours, theirs := convert([]byte(input))
-						if !bytes.Equal(ours, theirs) {
-							t.Fatalf("%s: bad conversion for %q (U+%04X). ours: %#v, theirs: %#v",
-								local.Name(), input, cp, ours, theirs,
-							)
-						}
+						require.True(t, bytes.Equal(ours, theirs), "%s: bad conversion for %q (U+%04X). ours: %#v, theirs: %#v", local.Name(), input, cp, ours, theirs)
+
 					}
 					panic("???")
 				}
@@ -127,11 +124,8 @@ func TestCJKStress(t *testing.T) {
 						ours, _ := charset.ConvertFromUTF8(nil, local, []byte(input))
 
 						ours2, theirs2 := unconvert(ours)
-						if !bytes.Equal(ours2, theirs2) {
-							t.Fatalf("%s: bad return conversion for %q (U+%04X) %#v. ours: %#v, theirs: %#v",
-								local.Name(), input, cp, ours, ours2, theirs2,
-							)
-						}
+						require.True(t, bytes.Equal(ours2, theirs2), "%s: bad return conversion for %q (U+%04X) %#v. ours: %#v, theirs: %#v", local.Name(), input, cp, ours, ours2, theirs2)
+
 					}
 					panic("???")
 				}
diff --git a/go/mysql/collations/integration/coercion_test.go b/go/mysql/collations/integration/coercion_test.go
index 58aae5aa97..e7257e5b95 100644
--- a/go/mysql/collations/integration/coercion_test.go
+++ b/go/mysql/collations/integration/coercion_test.go
@@ -23,6 +23,7 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 
 	"vitess.io/vitess/go/mysql/collations"
@@ -59,12 +60,8 @@ func (tc *testConcat) Expression() string {
 
 func (tc *testConcat) Test(t *testing.T, remote *RemoteCoercionResult, local collations.TypedCollation, coercion1, coercion2 collations.Coercion) {
 	localCollation := collations.Local().LookupByID(local.Collation)
-	if localCollation.Name() != remote.Collation.Name() {
-		t.Errorf("bad collation resolved: local is %s, remote is %s", localCollation.Name(), remote.Collation.Name())
-	}
-	if local.Coercibility != remote.Coercibility {
-		t.Errorf("bad coercibility resolved: local is %d, remote is %d", local.Coercibility, remote.Coercibility)
-	}
+	assert.Equal(t, remote.Collation.Name(), localCollation.Name(), "bad collation resolved: local is %s, remote is %s", localCollation.Name(), remote.Collation.Name())
+	assert.Equal(t, remote.Coercibility, local.Coercibility, "bad coercibility resolved: local is %d, remote is %d", local.Coercibility, remote.Coercibility)
 
 	leftText, err := coercion1(nil, tc.left.Text)
 	if err != nil {
@@ -84,14 +81,10 @@ func (tc *testConcat) Test(t *testing.T, remote *RemoteCoercionResult, local col
 
 	rEBytes, err := remote.Expr.ToBytes()
 	require.NoError(t, err)
-	if !bytes.Equal(concat.Bytes(), rEBytes) {
-		t.Errorf("failed to concatenate text;\n\tCONCAT(%v COLLATE %s, %v COLLATE %s) = \n\tCONCAT(%v, %v) COLLATE %s = \n\t\t%v\n\n\texpected: %v",
-			tc.left.Text, tc.left.Collation.Name(),
-			tc.right.Text, tc.right.Collation.Name(),
-			leftText, rightText, localCollation.Name(),
-			concat.Bytes(), rEBytes,
-		)
-	}
+	assert.True(t, bytes.Equal(concat.Bytes(), rEBytes), "failed to concatenate text;\n\tCONCAT(%v COLLATE %s, %v COLLATE %s) = \n\tCONCAT(%v, %v) COLLATE %s = \n\t\t%v\n\n\texpected: %v", tc.left.Text, tc.left.Collation.Name(),
+		tc.right.Text, tc.right.Collation.Name(), leftText, rightText, localCollation.Name(),
+		concat.Bytes(), rEBytes)
+
 }
 
 type testComparison struct {
@@ -122,10 +115,8 @@ func (tc *testComparison) Test(t *testing.T, remote *RemoteCoercionResult, local
 	require.NoError(t, err)
 	remoteEquals := rEBytes[0] == '1'
 	localEquals := localCollation.Collate(leftText, rightText, false) == 0
-	if remoteEquals != localEquals {
-		t.Errorf("failed to collate %#v = %#v with collation %s (expected %v, got %v)",
-			leftText, rightText, localCollation.Name(), remoteEquals, localEquals)
-	}
+	assert.Equal(t, localEquals, remoteEquals, "failed to collate %#v = %#v with collation %s (expected %v, got %v)", leftText, rightText, localCollation.Name(), remoteEquals, localEquals)
+
 }
 
 func TestComparisonSemantics(t *testing.T) {
@@ -199,16 +190,14 @@ func TestComparisonSemantics(t *testing.T) {
 
 					resultRemote, errRemote := conn.ExecuteFetch(query, 1, false)
 					if errRemote != nil {
-						if !strings.Contains(errRemote.Error(), "Illegal mix of collations") {
-							t.Fatalf("query %s failed: %v", query, errRemote)
-						}
+						require.True(t, strings.Contains(errRemote.Error(), "Illegal mix of collations"), "query %s failed: %v", query, errRemote)
+
 						if errLocal == nil {
 							t.Errorf("expected %s vs %s to fail coercion: %v", collA.Collation.Name(), collB.Collation.Name(), errRemote)
 							continue
 						}
-						if !strings.HasPrefix(normalizeCollationInError(errRemote.Error()), normalizeCollationInError(errLocal.Error())) {
-							t.Fatalf("bad error message: expected %q, got %q", errRemote, errLocal)
-						}
+						require.True(t, strings.HasPrefix(normalizeCollationInError(errRemote.Error()), normalizeCollationInError(errLocal.Error())), "bad error message: expected %q, got %q", errRemote, errLocal)
+
 						continue
 					}
 
diff --git a/go/mysql/collations/integration/collations_test.go b/go/mysql/collations/integration/collations_test.go
index d9cc6f11c3..32ffb81a49 100644
--- a/go/mysql/collations/integration/collations_test.go
+++ b/go/mysql/collations/integration/collations_test.go
@@ -116,9 +116,7 @@ func parseWeightString(b []byte) []byte {
 
 func (u *uca900CollationTest) Test(t *testing.T, result *sqltypes.Result) {
 	coll := collationEnv.LookupByName(u.collation)
-	if coll == nil {
-		t.Fatalf("unknown collation %q", u.collation)
-	}
+	require.NotNil(t, coll, "unknown collation %q", u.collation)
 
 	var checked, errors int
 	for _, row := range result.Rows {
@@ -231,10 +229,8 @@ func TestCollationWithSpace(t *testing.T) {
 			for _, size := range []int{0, codepoints, codepoints + 1, codepoints + 2, 20, 32} {
 				localWeight := local.WeightString(nil, []byte(ExampleString), size)
 				remoteWeight := remote.WeightString(nil, []byte(ExampleString), size)
-				if !bytes.Equal(localWeight, remoteWeight) {
-					t.Fatalf("mismatch at len=%d\ninput:    %#v\nexpected: %#v\nactual:   %#v",
-						size, []byte(ExampleString), remoteWeight, localWeight)
-				}
+				require.True(t, bytes.Equal(localWeight, remoteWeight), "mismatch at len=%d\ninput:    %#v\nexpected: %#v\nactual:   %#v", size, []byte(ExampleString), remoteWeight, localWeight)
+
 			}
 		})
 	}
diff --git a/go/mysql/collations/integration/helpers_test.go b/go/mysql/collations/integration/helpers_test.go
index cc67dd8204..d185168d9d 100644
--- a/go/mysql/collations/integration/helpers_test.go
+++ b/go/mysql/collations/integration/helpers_test.go
@@ -24,6 +24,9 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/mysql"
 	"vitess.io/vitess/go/mysql/collations"
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
@@ -55,10 +58,7 @@ func testRemoteWeights(t *testing.T, golden io.Writer, cases []testweight) {
 			if err := remote.LastError(); err != nil {
 				t.Fatalf("remote collation failed: %v", err)
 			}
-
-			if !bytes.Equal(localResult, remoteResult) {
-				t.Errorf("expected WEIGHT_STRING(%#v) = %#v (got %#v)", tc.input, remoteResult, localResult)
-			}
+			assert.True(t, bytes.Equal(localResult, remoteResult), "expected WEIGHT_STRING(%#v) = %#v (got %#v)", tc.input, remoteResult, localResult)
 
 			if golden != nil {
 				fmt.Fprintf(golden, "{\n\tcollation: %q,\n\texpected: %#v,\n},\n", tc.collation, remoteResult)
@@ -91,9 +91,8 @@ func testRemoteComparison(t *testing.T, golden io.Writer, cases []testcmp) {
 			if err := remote.LastError(); err != nil {
 				t.Fatalf("remote collation failed: %v", err)
 			}
-			if localResult != remoteResult {
-				t.Errorf("expected STRCMP(%q, %q) = %d (got %d)", string(tc.left), string(tc.right), remoteResult, localResult)
-			}
+			assert.Equal(t, remoteResult, localResult, "expected STRCMP(%q, %q) = %d (got %d)", string(tc.left), string(tc.right), remoteResult, localResult)
+
 			if golden != nil {
 				fmt.Fprintf(golden, "{\n\tcollation: %q,\n\tleft: %#v,\n\tright: %#v,\n\texpected: %d,\n},\n",
 					tc.collation, tc.left, tc.right, remoteResult)
@@ -104,16 +103,12 @@ func testRemoteComparison(t *testing.T, golden io.Writer, cases []testcmp) {
 
 func verifyTranscoding(t *testing.T, local collations.Collation, remote *remote.Collation, text []byte) []byte {
 	transRemote, err := charset.ConvertFromUTF8(nil, remote.Charset(), text)
-	if err != nil {
-		t.Fatalf("remote transcoding failed: %v", err)
-	}
+	require.NoError(t, err, "remote transcoding failed: %v", err)
 
 	transLocal, _ := charset.ConvertFromUTF8(nil, local.Charset(), text)
-	if !bytes.Equal(transLocal, transRemote) {
-		t.Fatalf("transcoding mismatch with %s (%d, charset: %s)\ninput:\n%s\nremote:\n%s\nlocal:\n%s\n",
-			local.Name(), local.ID(), local.Charset().Name(),
-			hex.Dump(text), hex.Dump(transRemote), hex.Dump(transLocal))
-	}
+	require.True(t, bytes.Equal(transLocal, transRemote), "transcoding mismatch with %s (%d, charset: %s)\ninput:\n%s\nremote:\n%s\nlocal:\n%s\n", local.Name(), local.ID(), local.Charset().Name(),
+		hex.Dump(text), hex.Dump(transRemote), hex.Dump(transLocal))
+
 	return transLocal
 }
 
@@ -143,9 +138,8 @@ func verifyWeightString(t *testing.T, local collations.Collation, remote *remote
 
 func exec(t *testing.T, conn *mysql.Conn, query string) *sqltypes.Result {
 	res, err := conn.ExecuteFetch(query, -1, true)
-	if err != nil {
-		t.Fatalf("failed to execute %q: %v", query, err)
-	}
+	require.NoError(t, err, "failed to execute %q: %v", query, err)
+
 	return res
 }
 
diff --git a/go/mysql/collations/uca_contraction_test.go b/go/mysql/collations/uca_contraction_test.go
index cfc1cf795f..f178b70009 100644
--- a/go/mysql/collations/uca_contraction_test.go
+++ b/go/mysql/collations/uca_contraction_test.go
@@ -26,6 +26,8 @@ import (
 	"testing"
 	"unicode/utf8"
 
+	"github.com/stretchr/testify/assert"
+
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 	"vitess.io/vitess/go/mysql/collations/internal/uca"
 )
@@ -96,15 +98,10 @@ func findContractedCollations(t testing.TB, unique bool) (result []CollationWith
 }
 
 func testMatch(t *testing.T, name string, cnt uca.Contraction, result []uint16, remainder []byte, skip int) {
-	if !reflect.DeepEqual(cnt.Weights, result) {
-		t.Errorf("%s didn't match: expected %#v, got %#v", name, cnt.Weights, result)
-	}
-	if len(remainder) != 0 {
-		t.Errorf("%s bad remainder: %#v", name, remainder)
-	}
-	if skip != len(cnt.Path) {
-		t.Errorf("%s bad skipped length %d for %#v", name, skip, cnt.Path)
-	}
+	assert.True(t, reflect.DeepEqual(cnt.Weights, result), "%s didn't match: expected %#v, got %#v", name, cnt.Weights, result)
+	assert.Equal(t, 0, len(remainder), "%s bad remainder: %#v", name, remainder)
+	assert.Equal(t, len(cnt.Path), skip, "%s bad skipped length %d for %#v", name, skip, cnt.Path)
+
 }
 
 func TestUCAContractions(t *testing.T) {
diff --git a/go/mysql/collations/uca_tables_test.go b/go/mysql/collations/uca_tables_test.go
index e7a8063e5d..46d83a85ec 100644
--- a/go/mysql/collations/uca_tables_test.go
+++ b/go/mysql/collations/uca_tables_test.go
@@ -26,6 +26,7 @@ import (
 	"unsafe"
 
 	"github.com/stretchr/testify/require"
+	"gotest.tools/assert"
 
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 	"vitess.io/vitess/go/mysql/collations/internal/uca"
@@ -57,9 +58,8 @@ func verifyAllCodepoints(t *testing.T, expected map[rune][]uint16, weights uca.W
 
 			for i := range vitessWeights {
 				a, b := mysqlWeights[i], vitessWeights[i]
-				if a != b {
-					t.Errorf("weight mismatch for U+%04X (collation entity %d): mysql=%v vitess=%v", cp, i+1, a, b)
-				}
+				assert.Equal(t, b, a, "weight mismatch for U+%04X (collation entity %d): mysql=%v vitess=%v", cp, i+1, a, b)
+
 			}
 		}
 	}
diff --git a/go/mysql/collations/uca_test.go b/go/mysql/collations/uca_test.go
index ad1231dd39..df5267eb29 100644
--- a/go/mysql/collations/uca_test.go
+++ b/go/mysql/collations/uca_test.go
@@ -25,6 +25,9 @@ import (
 	"testing"
 	"unicode/utf8"
 
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 )
 
@@ -53,9 +56,8 @@ func testcollation(t testing.TB, name string) Collation {
 	t.Helper()
 	testinit()
 	coll := testcollationMap[name]
-	if coll == nil {
-		t.Fatalf("missing collation: %s", name)
-	}
+	require.NotNil(t, coll, "missing collation: %s", name)
+
 	return coll
 }
 
@@ -81,9 +83,8 @@ func TestWeightsForSpace(t *testing.T) {
 		default:
 			continue
 		}
-		if actual != expected {
-			t.Errorf("expected Weight(' ') == 0x%X, got 0x%X", expected, actual)
-		}
+		assert.Equal(t, expected, actual, "expected Weight(' ') == 0x%X, got 0x%X", expected, actual)
+
 	}
 }
 
@@ -104,9 +105,8 @@ func TestKanaSensitivity(t *testing.T) {
 		t.Run(tc.collation, func(t *testing.T) {
 			collation := testcollation(t, tc.collation)
 			equal := collation.Collate([]byte(Kana1), []byte(Kana2), false) == 0
-			if equal != tc.equal {
-				t.Errorf("expected %q == %q to be %v", Kana1, Kana2, tc.equal)
-			}
+			assert.Equal(t, tc.equal, equal, "expected %q == %q to be %v", Kana1, Kana2, tc.equal)
+
 		})
 	}
 }
@@ -135,9 +135,8 @@ func TestContractions(t *testing.T) {
 
 			for _, in := range tc.inputs {
 				weightString := coll.WeightString(nil, []byte(in), 0)
-				if !bytes.Equal(weightString, tc.expected) {
-					t.Errorf("weight_string(%q) = %#v (expected %#v)", in, weightString, tc.expected)
-				}
+				assert.True(t, bytes.Equal(weightString, tc.expected), "weight_string(%q) = %#v (expected %#v)", in, weightString, tc.expected)
+
 			}
 		})
 	}
@@ -157,9 +156,8 @@ func TestReplacementCharacter(t *testing.T) {
 		t.Run(tc.collation, func(t *testing.T) {
 			coll := testcollation(t, tc.collation)
 			weightString := coll.WeightString(nil, []byte(string(utf8.RuneError)), 0)
-			if !bytes.Equal(weightString, tc.expected) {
-				t.Errorf("weight_string(\\uFFFD) = %#v (expected %#v)", weightString, tc.expected)
-			}
+			assert.True(t, bytes.Equal(weightString, tc.expected), "weight_string(\\uFFFD) = %#v (expected %#v)", weightString, tc.expected)
+
 		})
 	}
 }
@@ -182,9 +180,8 @@ func TestIsPrefix(t *testing.T) {
 			right := string(input[:size])
 
 			cmp := coll.Collate([]byte(left), []byte(right), true)
-			if cmp != 0 {
-				t.Errorf("IsPrefix(%q, %q) = %d (expected 0)", left, right, cmp)
-			}
+			assert.Equal(t, 0, cmp, "IsPrefix(%q, %q) = %d (expected 0)", left, right, cmp)
+
 		}
 	}
 }
@@ -799,10 +796,8 @@ func TestCompareWithWeightString(t *testing.T) {
 	for _, tc := range cases {
 		left := collation.WeightString(nil, []byte(tc.left), 0)
 		right := collation.WeightString(nil, []byte(tc.right), 0)
+		assert.Equal(t, tc.equal, bytes.Equal(left, right), "expected %q / %v == %q / %v to be %v", tc.left, left, tc.right, right, tc.equal)
 
-		if bytes.Equal(left, right) != tc.equal {
-			t.Errorf("expected %q / %v == %q / %v to be %v", tc.left, left, tc.right, right, tc.equal)
-		}
 	}
 }
 
@@ -835,9 +830,8 @@ func TestFastIterators(t *testing.T) {
 		t.Run(tc.collation, func(t *testing.T) {
 			coll := testcollation(t, tc.collation)
 			result := coll.WeightString(nil, allASCIICharacters, 0)
-			if !bytes.Equal(tc.expected, result) {
-				t.Errorf("weight_string(%q) = %#v (expected %#v)", allASCIICharacters, result, tc.expected)
-			}
+			assert.True(t, bytes.Equal(tc.expected, result), "weight_string(%q) = %#v (expected %#v)", allASCIICharacters, result, tc.expected)
+
 		})
 	}
 }
@@ -905,9 +899,8 @@ func TestEqualities(t *testing.T) {
 		collation = &ConsistentCollation{Collation: collation, t: t}
 
 		cmp := collation.Collate([]byte(tc.left), []byte(tc.right), false)
-		if (cmp == 0) != tc.equal {
-			t.Errorf("expected %q == %q to be %v", tc.left, tc.right, tc.equal)
-		}
+		assert.Equal(t, tc.equal, (cmp == 0), "expected %q == %q to be %v", tc.left, tc.right, tc.equal)
+
 	}
 }
 
diff --git a/go/mysql/collations/wildcard_test.go b/go/mysql/collations/wildcard_test.go
index d45a116e11..ef0430505d 100644
--- a/go/mysql/collations/wildcard_test.go
+++ b/go/mysql/collations/wildcard_test.go
@@ -19,6 +19,8 @@ package collations
 import (
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+
 	"vitess.io/vitess/go/mysql/collations/internal/charset"
 )
 
@@ -33,9 +35,8 @@ func testWildcardMatches(t *testing.T, collName string, chOne, chMany, chEsc run
 		for _, tc := range cases {
 			pat := coll.Wildcard([]byte(tc.pat), chOne, chMany, chEsc)
 			match := pat.Match([]byte(tc.in))
-			if match != tc.match {
-				t.Errorf("%q LIKE %q = %v (expected %v)", tc.in, tc.pat, match, tc.match)
-			}
+			assert.Equal(t, tc.match, match, "%q LIKE %q = %v (expected %v)", tc.in, tc.pat, match, tc.match)
+
 		}
 	})
 }
@@ -343,9 +344,8 @@ func TestWildcardMatches(t *testing.T) {
 		for _, tc := range wildcardTestCases {
 			wildcard := newUnicodeWildcardMatcher(charset.Charset_utf8mb4{}, identity, nil, []byte(tc.pat), '?', '*', '\\')
 			match := wildcard.Match([]byte(tc.in))
-			if match != tc.match {
-				t.Errorf("wildcard(%q, %q) = %v (expected %v)", tc.in, tc.pat, match, tc.match)
-			}
+			assert.Equal(t, tc.match, match, "wildcard(%q, %q) = %v (expected %v)", tc.in, tc.pat, match, tc.match)
+
 		}
 	})
 
@@ -353,9 +353,8 @@ func TestWildcardMatches(t *testing.T) {
 		for _, tc := range wildcardTestCases {
 			wildcard := newEightbitWildcardMatcher(&sortOrderIdentity, nil, []byte(tc.pat), '?', '*', '\\')
 			match := wildcard.Match([]byte(tc.in))
-			if match != tc.match {
-				t.Errorf("wildcard(%q, %q) = %v (expected %v)", tc.in, tc.pat, match, tc.match)
-			}
+			assert.Equal(t, tc.match, match, "wildcard(%q, %q) = %v (expected %v)", tc.in, tc.pat, match, tc.match)
+
 		}
 	})
 
diff --git a/go/mysql/conn_flaky_test.go b/go/mysql/conn_flaky_test.go
index bdb1a368b9..ada543e7ef 100644
--- a/go/mysql/conn_flaky_test.go
+++ b/go/mysql/conn_flaky_test.go
@@ -46,9 +46,8 @@ import (
 func createSocketPair(t *testing.T) (net.Listener, *Conn, *Conn) {
 	// Create a listener.
 	listener, err := net.Listen("tcp", "127.0.0.1:")
-	if err != nil {
-		t.Fatalf("Listen failed: %v", err)
-	}
+	require.NoError(t, err, "Listen failed: %v", err)
+
 	addr := listener.Addr().String()
 	listener.(*net.TCPListener).SetDeadline(time.Now().Add(10 * time.Second))
 
@@ -72,13 +71,8 @@ func createSocketPair(t *testing.T) (net.Listener, *Conn, *Conn) {
 	}()
 
 	wg.Wait()
-
-	if clientErr != nil {
-		t.Fatalf("Dial failed: %v", clientErr)
-	}
-	if serverErr != nil {
-		t.Fatalf("Accept failed: %v", serverErr)
-	}
+	require.Nil(t, clientErr, "Dial failed: %v", clientErr)
+	require.Nil(t, serverErr, "Accept failed: %v", serverErr)
 
 	// Create a Conn on both sides.
 	cConn := newConn(clientConn)
@@ -746,9 +740,8 @@ func TestEOFOrLengthEncodedIntFuzz(t *testing.T) {
 	for i := 0; i < 100; i++ {
 		bytes := make([]byte, rand.Intn(16)+1)
 		_, err := crypto_rand.Read(bytes)
-		if err != nil {
-			t.Fatalf("error doing rand.Read")
-		}
+		require.NoError(t, err, "error doing rand.Read")
+
 		bytes[0] = 0xfe
 
 		_, _, isInt := readLenEncInt(bytes, 0)
diff --git a/go/mysql/constants_test.go b/go/mysql/constants_test.go
index a3da0bf2fc..34d8c09ca5 100644
--- a/go/mysql/constants_test.go
+++ b/go/mysql/constants_test.go
@@ -19,6 +19,8 @@ package mysql
 import (
 	"errors"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestIsConnErr(t *testing.T) {
@@ -46,9 +48,8 @@ func TestIsConnErr(t *testing.T) {
 	}}
 	for _, tcase := range testcases {
 		got := IsConnErr(tcase.in)
-		if got != tcase.want {
-			t.Errorf("IsConnErr(%#v): %v, want %v", tcase.in, got, tcase.want)
-		}
+		assert.Equal(t, tcase.want, got, "IsConnErr(%#v): %v, want %v", tcase.in, got, tcase.want)
+
 	}
 }
 
@@ -77,8 +78,7 @@ func TestIsConnLostDuringQuery(t *testing.T) {
 	}}
 	for _, tcase := range testcases {
 		got := IsConnLostDuringQuery(tcase.in)
-		if got != tcase.want {
-			t.Errorf("IsConnLostDuringQuery(%#v): %v, want %v", tcase.in, got, tcase.want)
-		}
+		assert.Equal(t, tcase.want, got, "IsConnLostDuringQuery(%#v): %v, want %v", tcase.in, got, tcase.want)
+
 	}
 }
diff --git a/go/mysql/encoding_test.go b/go/mysql/encoding_test.go
index ac38b5c7db..c0081a6455 100644
--- a/go/mysql/encoding_test.go
+++ b/go/mysql/encoding_test.go
@@ -19,6 +19,8 @@ package mysql
 import (
 	"bytes"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestEncLenInt(t *testing.T) {
@@ -52,22 +54,14 @@ func TestEncLenInt(t *testing.T) {
 		// Check successful encoding.
 		data := make([]byte, len(test.encoded))
 		pos := writeLenEncInt(data, 0, test.value)
-		if pos != len(test.encoded) {
-			t.Errorf("unexpected pos %v after writeLenEncInt(%x), expected %v", pos, test.value, len(test.encoded))
-		}
-		if !bytes.Equal(data, test.encoded) {
-			t.Errorf("unexpected encoded value for %x, got %v expected %v", test.value, data, test.encoded)
-		}
+		assert.Equal(t, len(test.encoded), pos, "unexpected pos %v after writeLenEncInt(%x), expected %v", pos, test.value, len(test.encoded))
+		assert.True(t, bytes.Equal(data, test.encoded), "unexpected encoded value for %x, got %v expected %v", test.value, data, test.encoded)
 
 		// Check successful encoding with offset.
 		data = make([]byte, len(test.encoded)+1)
 		pos = writeLenEncInt(data, 1, test.value)
-		if pos != len(test.encoded)+1 {
-			t.Errorf("unexpected pos %v after writeLenEncInt(%x, 1), expected %v", pos, test.value, len(test.encoded)+1)
-		}
-		if !bytes.Equal(data[1:], test.encoded) {
-			t.Errorf("unexpected encoded value for %x, got %v expected %v", test.value, data, test.encoded)
-		}
+		assert.Equal(t, len(test.encoded)+1, pos, "unexpected pos %v after writeLenEncInt(%x, 1), expected %v", pos, test.value, len(test.encoded)+1)
+		assert.True(t, bytes.Equal(data[1:], test.encoded), "unexpected encoded value for %x, got %v expected %v", test.value, data, test.encoded)
 
 		// Check successful decoding.
 		got, pos, ok := readLenEncInt(test.encoded, 0)
@@ -77,9 +71,8 @@ func TestEncLenInt(t *testing.T) {
 
 		// Check failed decoding.
 		_, _, ok = readLenEncInt(test.encoded[:len(test.encoded)-1], 0)
-		if ok {
-			t.Errorf("readLenEncInt returned ok=true for shorter value %x", test.value)
-		}
+		assert.False(t, ok, "readLenEncInt returned ok=true for shorter value %x", test.value)
+
 	}
 }
 
@@ -102,9 +95,8 @@ func TestEncUint16(t *testing.T) {
 	}
 
 	_, _, ok = readUint16(data, 9)
-	if ok {
-		t.Errorf("readUint16 returned ok=true for shorter value")
-	}
+	assert.False(t, ok, "readUint16 returned ok=true for shorter value")
+
 }
 
 func TestEncBytes(t *testing.T) {
@@ -120,9 +112,7 @@ func TestEncBytes(t *testing.T) {
 	}
 
 	_, _, ok = readByte(data, 10)
-	if ok {
-		t.Errorf("readByte returned ok=true for shorter value")
-	}
+	assert.False(t, ok, "readByte returned ok=true for shorter value")
 
 	b, pos, ok := readBytes(data, 5, 2)
 	expected := []byte{0xab, 0x00}
@@ -131,9 +121,8 @@ func TestEncBytes(t *testing.T) {
 	}
 
 	_, _, ok = readBytes(data, 9, 2)
-	if ok {
-		t.Errorf("readBytes returned ok=true for shorter value")
-	}
+	assert.False(t, ok, "readBytes returned ok=true for shorter value")
+
 }
 
 func TestEncUint32(t *testing.T) {
@@ -155,9 +144,8 @@ func TestEncUint32(t *testing.T) {
 	}
 
 	_, _, ok = readUint32(data, 7)
-	if ok {
-		t.Errorf("readUint32 returned ok=true for shorter value")
-	}
+	assert.False(t, ok, "readUint32 returned ok=true for shorter value")
+
 }
 
 func TestEncUint64(t *testing.T) {
@@ -180,9 +168,8 @@ func TestEncUint64(t *testing.T) {
 	}
 
 	_, _, ok = readUint64(data, 7)
-	if ok {
-		t.Errorf("readUint64 returned ok=true for shorter value")
-	}
+	assert.False(t, ok, "readUint64 returned ok=true for shorter value")
+
 }
 
 func TestEncString(t *testing.T) {
@@ -232,22 +219,14 @@ func TestEncString(t *testing.T) {
 		// Check successful encoding.
 		data := make([]byte, len(test.lenEncoded))
 		pos := writeLenEncString(data, 0, test.value)
-		if pos != len(test.lenEncoded) {
-			t.Errorf("unexpected pos %v after writeLenEncString(%v), expected %v", pos, test.value, len(test.lenEncoded))
-		}
-		if !bytes.Equal(data, test.lenEncoded) {
-			t.Errorf("unexpected lenEncoded value for %v, got %v expected %v", test.value, data, test.lenEncoded)
-		}
+		assert.Equal(t, len(test.lenEncoded), pos, "unexpected pos %v after writeLenEncString(%v), expected %v", pos, test.value, len(test.lenEncoded))
+		assert.True(t, bytes.Equal(data, test.lenEncoded), "unexpected lenEncoded value for %v, got %v expected %v", test.value, data, test.lenEncoded)
 
 		// Check successful encoding with offset.
 		data = make([]byte, len(test.lenEncoded)+1)
 		pos = writeLenEncString(data, 1, test.value)
-		if pos != len(test.lenEncoded)+1 {
-			t.Errorf("unexpected pos %v after writeLenEncString(%v, 1), expected %v", pos, test.value, len(test.lenEncoded)+1)
-		}
-		if !bytes.Equal(data[1:], test.lenEncoded) {
-			t.Errorf("unexpected lenEncoded value for %v, got %v expected %v", test.value, data[1:], test.lenEncoded)
-		}
+		assert.Equal(t, len(test.lenEncoded)+1, pos, "unexpected pos %v after writeLenEncString(%v, 1), expected %v", pos, test.value, len(test.lenEncoded)+1)
+		assert.True(t, bytes.Equal(data[1:], test.lenEncoded), "unexpected lenEncoded value for %v, got %v expected %v", test.value, data[1:], test.lenEncoded)
 
 		// Check successful decoding as string.
 		got, pos, ok := readLenEncString(test.lenEncoded, 0)
@@ -257,15 +236,11 @@ func TestEncString(t *testing.T) {
 
 		// Check failed decoding with shorter data.
 		_, _, ok = readLenEncString(test.lenEncoded[:len(test.lenEncoded)-1], 0)
-		if ok {
-			t.Errorf("readLenEncString returned ok=true for shorter value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncString returned ok=true for shorter value %v", test.value)
 
 		// Check failed decoding with no data.
 		_, _, ok = readLenEncString([]byte{}, 0)
-		if ok {
-			t.Errorf("readLenEncString returned ok=true for empty value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncString returned ok=true for empty value %v", test.value)
 
 		// Check successful skipping as string.
 		pos, ok = skipLenEncString(test.lenEncoded, 0)
@@ -275,15 +250,11 @@ func TestEncString(t *testing.T) {
 
 		// Check failed skipping with shorter data.
 		_, ok = skipLenEncString(test.lenEncoded[:len(test.lenEncoded)-1], 0)
-		if ok {
-			t.Errorf("skipLenEncString returned ok=true for shorter value %v", test.value)
-		}
+		assert.False(t, ok, "skipLenEncString returned ok=true for shorter value %v", test.value)
 
 		// Check failed skipping with no data.
 		_, ok = skipLenEncString([]byte{}, 0)
-		if ok {
-			t.Errorf("skipLenEncString returned ok=true for empty value %v", test.value)
-		}
+		assert.False(t, ok, "skipLenEncString returned ok=true for empty value %v", test.value)
 
 		// Check successful decoding as bytes.
 		gotb, pos, ok := readLenEncStringAsBytes(test.lenEncoded, 0)
@@ -293,15 +264,11 @@ func TestEncString(t *testing.T) {
 
 		// Check failed decoding as bytes with shorter data.
 		_, _, ok = readLenEncStringAsBytes(test.lenEncoded[:len(test.lenEncoded)-1], 0)
-		if ok {
-			t.Errorf("readLenEncStringAsBytes returned ok=true for shorter value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncStringAsBytes returned ok=true for shorter value %v", test.value)
 
 		// Check failed decoding as bytes with no data.
 		_, _, ok = readLenEncStringAsBytes([]byte{}, 0)
-		if ok {
-			t.Errorf("readLenEncStringAsBytes returned ok=true for empty value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncStringAsBytes returned ok=true for empty value %v", test.value)
 
 		// Check successful decoding as bytes.
 		gotbcopy, posCopy, ok := readLenEncStringAsBytesCopy(test.lenEncoded, 0)
@@ -311,27 +278,19 @@ func TestEncString(t *testing.T) {
 
 		// Check failed decoding as bytes with shorter data.
 		_, _, ok = readLenEncStringAsBytesCopy(test.lenEncoded[:len(test.lenEncoded)-1], 0)
-		if ok {
-			t.Errorf("readLenEncStringAsBytes returned ok=true for shorter value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncStringAsBytes returned ok=true for shorter value %v", test.value)
 
 		// Check failed decoding as bytes with no data.
 		_, _, ok = readLenEncStringAsBytesCopy([]byte{}, 0)
-		if ok {
-			t.Errorf("readLenEncStringAsBytes returned ok=true for empty value %v", test.value)
-		}
+		assert.False(t, ok, "readLenEncStringAsBytes returned ok=true for empty value %v", test.value)
 
 		// null encoded tests.
 
 		// Check successful encoding.
 		data = make([]byte, len(test.nullEncoded))
 		pos = writeNullString(data, 0, test.value)
-		if pos != len(test.nullEncoded) {
-			t.Errorf("unexpected pos %v after writeNullString(%v), expected %v", pos, test.value, len(test.nullEncoded))
-		}
-		if !bytes.Equal(data, test.nullEncoded) {
-			t.Errorf("unexpected nullEncoded value for %v, got %v expected %v", test.value, data, test.nullEncoded)
-		}
+		assert.Equal(t, len(test.nullEncoded), pos, "unexpected pos %v after writeNullString(%v), expected %v", pos, test.value, len(test.nullEncoded))
+		assert.True(t, bytes.Equal(data, test.nullEncoded), "unexpected nullEncoded value for %v, got %v expected %v", test.value, data, test.nullEncoded)
 
 		// Check successful decoding.
 		got, pos, ok = readNullString(test.nullEncoded, 0)
@@ -341,21 +300,15 @@ func TestEncString(t *testing.T) {
 
 		// Check failed decoding with shorter data.
 		_, _, ok = readNullString(test.nullEncoded[:len(test.nullEncoded)-1], 0)
-		if ok {
-			t.Errorf("readNullString returned ok=true for shorter value %v", test.value)
-		}
+		assert.False(t, ok, "readNullString returned ok=true for shorter value %v", test.value)
 
 		// EOF encoded tests.
 
 		// Check successful encoding.
 		data = make([]byte, len(test.eofEncoded))
 		pos = writeEOFString(data, 0, test.value)
-		if pos != len(test.eofEncoded) {
-			t.Errorf("unexpected pos %v after writeEOFString(%v), expected %v", pos, test.value, len(test.eofEncoded))
-		}
-		if !bytes.Equal(data, test.eofEncoded[:len(test.eofEncoded)]) {
-			t.Errorf("unexpected eofEncoded value for %v, got %v expected %v", test.value, data, test.eofEncoded)
-		}
+		assert.Equal(t, len(test.eofEncoded), pos, "unexpected pos %v after writeEOFString(%v), expected %v", pos, test.value, len(test.eofEncoded))
+		assert.True(t, bytes.Equal(data, test.eofEncoded[:len(test.eofEncoded)]), "unexpected eofEncoded value for %v, got %v expected %v", test.value, data, test.eofEncoded)
 
 		// Check successful decoding.
 		got, pos, ok = readEOFString(test.eofEncoded, 0)
diff --git a/go/mysql/endtoend/client_test.go b/go/mysql/endtoend/client_test.go
index 312ef5e773..a48c9629d5 100644
--- a/go/mysql/endtoend/client_test.go
+++ b/go/mysql/endtoend/client_test.go
@@ -243,10 +243,8 @@ func expectNoError(t *testing.T, err error) {
 
 func expectFlag(t *testing.T, msg string, flag, want bool) {
 	t.Helper()
-	if flag != want {
-		// We cannot continue the test if flag is incorrect.
-		t.Fatalf("%s: %v, want: %v", msg, flag, want)
-	}
+	require.Equal(t, want, flag, "%s: %v, want: %v", msg, flag, want)
+
 }
 
 // TestTLS tests our client can connect via SSL.
@@ -256,12 +254,8 @@ func TestTLS(t *testing.T) {
 
 	// First make sure the official 'mysql' client can connect.
 	output, ok := runMysql(t, &params, "status")
-	if !ok {
-		t.Fatalf("'mysql -e status' failed: %v", output)
-	}
-	if !strings.Contains(output, "Cipher in use is") {
-		t.Fatalf("cannot connect via SSL: %v", output)
-	}
+	require.True(t, ok, "'mysql -e status' failed: %v", output)
+	require.True(t, strings.Contains(output, "Cipher in use is"), "cannot connect via SSL: %v", output)
 
 	// Now connect with our client.
 	ctx := context.Background()
@@ -272,9 +266,8 @@ func TestTLS(t *testing.T) {
 	defer conn.Close()
 
 	result, err := conn.ExecuteFetch("SHOW STATUS LIKE 'Ssl_cipher'", 10, true)
-	if err != nil {
-		t.Fatalf("SHOW STATUS LIKE 'Ssl_cipher' failed: %v", err)
-	}
+	require.NoError(t, err, "SHOW STATUS LIKE 'Ssl_cipher' failed: %v", err)
+
 	if len(result.Rows) != 1 || result.Rows[0][0].ToString() != "Ssl_cipher" ||
 		result.Rows[0][1].ToString() == "" {
 		t.Fatalf("SHOW STATUS LIKE 'Ssl_cipher' returned unexpected result: %v", result)
@@ -291,9 +284,8 @@ func TestReplicationStatus(t *testing.T) {
 	defer conn.Close()
 
 	status, err := conn.ShowReplicationStatus()
-	if err != mysql.ErrNotReplica {
-		t.Errorf("Got unexpected result for ShowReplicationStatus: %v %v", status, err)
-	}
+	assert.Equal(t, mysql.ErrNotReplica, err, "Got unexpected result for ShowReplicationStatus: %v %v", status, err)
+
 }
 
 func TestSessionTrackGTIDs(t *testing.T) {
@@ -326,9 +318,7 @@ func TestCachingSha2Password(t *testing.T) {
 	defer conn.Close()
 
 	qr, err := conn.ExecuteFetch(`select true from information_schema.PLUGINS where PLUGIN_NAME='caching_sha2_password' and PLUGIN_STATUS='ACTIVE'`, 1, false)
-	if err != nil {
-		t.Errorf("select true from information_schema.PLUGINS failed: %v", err)
-	}
+	assert.NoError(t, err, "select true from information_schema.PLUGINS failed: %v", err)
 
 	if len(qr.Rows) != 1 {
 		t.Skip("Server does not support caching_sha2_password plugin")
@@ -370,12 +360,8 @@ func TestClientInfo(t *testing.T) {
 
 	// This is the simplest query that would return some textual data in the 'info' field
 	result, err := conn.ExecuteFetch(`PREPARE stmt1 FROM 'SELECT 1 = 1'`, -1, true)
-	if err != nil {
-		t.Fatalf("select failed: %v", err)
-	}
-	if result.Info != infoPrepared {
-		t.Fatalf("expected result.Info=%q, got=%q", infoPrepared, result.Info)
-	}
+	require.NoError(t, err, "select failed: %v", err)
+	require.Equal(t, infoPrepared, result.Info, "expected result.Info=%q, got=%q", infoPrepared, result.Info)
 }
 
 func TestBaseShowTables(t *testing.T) {
diff --git a/go/mysql/endtoend/main_test.go b/go/mysql/endtoend/main_test.go
index a18e278a26..b72b466e4a 100644
--- a/go/mysql/endtoend/main_test.go
+++ b/go/mysql/endtoend/main_test.go
@@ -25,6 +25,8 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/mysql"
 	vtenv "vitess.io/vitess/go/vt/env"
 	"vitess.io/vitess/go/vt/mysqlctl"
@@ -41,38 +43,25 @@ var (
 // assertSQLError makes sure we get the right error.
 func assertSQLError(t *testing.T, err error, code int, sqlState string, subtext string, query string) {
 	t.Helper()
+	require.Error(t, err, "was expecting SQLError %v / %v / %v but got no error.", code, sqlState, subtext)
 
-	if err == nil {
-		t.Fatalf("was expecting SQLError %v / %v / %v but got no error.", code, sqlState, subtext)
-	}
 	serr, ok := err.(*mysql.SQLError)
-	if !ok {
-		t.Fatalf("was expecting SQLError %v / %v / %v but got: %v", code, sqlState, subtext, err)
-	}
-	if serr.Num != code {
-		t.Fatalf("was expecting SQLError %v / %v / %v but got code %v", code, sqlState, subtext, serr.Num)
-	}
-	if serr.State != sqlState {
-		t.Fatalf("was expecting SQLError %v / %v / %v but got state %v", code, sqlState, subtext, serr.State)
-	}
-	if subtext != "" && !strings.Contains(serr.Message, subtext) {
-		t.Fatalf("was expecting SQLError %v / %v / %v but got message %v", code, sqlState, subtext, serr.Message)
-	}
-	if serr.Query != query {
-		t.Fatalf("was expecting SQLError %v / %v / %v with Query '%v' but got query '%v'", code, sqlState, subtext, query, serr.Query)
-	}
+	require.True(t, ok, "was expecting SQLError %v / %v / %v but got: %v", code, sqlState, subtext, err)
+	require.Equal(t, code, serr.Num, "was expecting SQLError %v / %v / %v but got code %v", code, sqlState, subtext, serr.Num)
+	require.Equal(t, sqlState, serr.State, "was expecting SQLError %v / %v / %v but got state %v", code, sqlState, subtext, serr.State)
+	require.True(t, subtext == "" || strings.Contains(serr.Message, subtext), "was expecting SQLError %v / %v / %v but got message %v", code, sqlState, subtext, serr.Message)
+	require.Equal(t, query, serr.Query, "was expecting SQLError %v / %v / %v with Query '%v' but got query '%v'", code, sqlState, subtext, query, serr.Query)
+
 }
 
 // runMysql forks a mysql command line process connecting to the provided server.
 func runMysql(t *testing.T, params *mysql.ConnParams, command string) (string, bool) {
 	dir, err := vtenv.VtMysqlRoot()
-	if err != nil {
-		t.Fatalf("vtenv.VtMysqlRoot failed: %v", err)
-	}
+	require.NoError(t, err, "vtenv.VtMysqlRoot failed: %v", err)
+
 	name, err := binaryPath(dir, "mysql")
-	if err != nil {
-		t.Fatalf("binaryPath failed: %v", err)
-	}
+	require.NoError(t, err, "binaryPath failed: %v", err)
+
 	// The args contain '-v' 3 times, to switch to very verbose output.
 	// In particular, it has the message:
 	// Query OK, 1 row affected (0.00 sec)
diff --git a/go/mysql/endtoend/query_test.go b/go/mysql/endtoend/query_test.go
index 839c989c05..473a51f88f 100644
--- a/go/mysql/endtoend/query_test.go
+++ b/go/mysql/endtoend/query_test.go
@@ -61,27 +61,21 @@ func TestQueries(t *testing.T) {
 
 	// Try a simple DDL.
 	result, err := conn.ExecuteFetch("create table a(id int, name varchar(128), primary key(id))", 0, false)
-	if err != nil {
-		t.Fatalf("create table failed: %v", err)
-	}
-	if result.RowsAffected != 0 {
-		t.Errorf("create table returned RowsAffected %v, was expecting 0", result.RowsAffected)
-	}
+	require.NoError(t, err, "create table failed: %v", err)
+	assert.Equal(t, uint64(0), result.RowsAffected, "create table returned RowsAffected %v, was expecting 0", result.RowsAffected)
 
 	// Try a simple insert.
 	result, err = conn.ExecuteFetch("insert into a(id, name) values(10, 'nice name')", 1000, true)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for insert: %v", result)
 	}
 
 	// And re-read what we inserted.
 	result, err = conn.ExecuteFetch("select * from a", 1000, true)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
 	collID := getDefaultCollationID()
 	expectedResult := &sqltypes.Result{
 		Fields: []*querypb.Field{
@@ -120,20 +114,16 @@ func TestQueries(t *testing.T) {
 	if !result.Equal(expectedResult) {
 		// MySQL 5.7 is adding the NO_DEFAULT_VALUE_FLAG to Flags.
 		expectedResult.Fields[0].Flags |= uint32(querypb.MySqlFlag_NO_DEFAULT_VALUE_FLAG)
-		if !result.Equal(expectedResult) {
-			t.Errorf("unexpected result for select, got:\n%v\nexpected:\n%v\n", result, expectedResult)
-		}
+		assert.True(t, result.Equal(expectedResult), "unexpected result for select, got:\n%v\nexpected:\n%v\n", result, expectedResult)
+
 	}
 
 	// Insert a few rows.
 	for i := 0; i < 100; i++ {
 		result, err := conn.ExecuteFetch(fmt.Sprintf("insert into a(id, name) values(%v, 'nice name %v')", 1000+i, i), 1000, true)
-		if err != nil {
-			t.Fatalf("ExecuteFetch(%v) failed: %v", i, err)
-		}
-		if result.RowsAffected != 1 {
-			t.Errorf("insert into returned RowsAffected %v, was expecting 1", result.RowsAffected)
-		}
+		require.NoError(t, err, "ExecuteFetch(%v) failed: %v", i, err)
+		assert.Equal(t, uint64(1), result.RowsAffected, "insert into returned RowsAffected %v, was expecting 1", result.RowsAffected)
+
 	}
 
 	// And use a streaming query to read them back.
@@ -143,12 +133,9 @@ func TestQueries(t *testing.T) {
 
 	// And drop the table.
 	result, err = conn.ExecuteFetch("drop table a", 0, false)
-	if err != nil {
-		t.Fatalf("drop table failed: %v", err)
-	}
-	if result.RowsAffected != 0 {
-		t.Errorf("insert into returned RowsAffected %v, was expecting 0", result.RowsAffected)
-	}
+	require.NoError(t, err, "drop table failed: %v", err)
+	assert.Equal(t, uint64(0), result.RowsAffected, "insert into returned RowsAffected %v, was expecting 0", result.RowsAffected)
+
 }
 
 func TestLargeQueries(t *testing.T) {
@@ -172,16 +159,14 @@ func TestLargeQueries(t *testing.T) {
 			expectedString := randString((i+1)*mysql.MaxPacketSize + j)
 
 			result, err := conn.ExecuteFetch(fmt.Sprintf("select \"%s\"", expectedString), -1, true)
-			if err != nil {
-				t.Fatalf("ExecuteFetch failed: %v", err)
-			}
+			require.NoError(t, err, "ExecuteFetch failed: %v", err)
+
 			if len(result.Rows) != 1 || len(result.Rows[0]) != 1 || result.Rows[0][0].IsNull() {
 				t.Fatalf("ExecuteFetch on large query returned poorly-formed result. " +
 					"Expected single row single column string.")
 			}
-			if result.Rows[0][0].ToString() != expectedString {
-				t.Fatalf("Result row was incorrect. Suppressing large string")
-			}
+			require.Equal(t, expectedString, result.Rows[0][0].ToString(), "Result row was incorrect. Suppressing large string")
+
 		}
 	}
 }
@@ -221,36 +206,31 @@ func readRowsUsingStream(t *testing.T, conn *mysql.Conn, expectedCount int) {
 		},
 	}
 	fields, err := conn.Fields()
-	if err != nil {
-		t.Fatalf("Fields failed: %v", err)
-	}
+	require.NoError(t, err, "Fields failed: %v", err)
+
 	if !sqltypes.FieldsEqual(fields, expectedFields) {
 		// MySQL 5.7 is adding the NO_DEFAULT_VALUE_FLAG to Flags.
 		expectedFields[0].Flags |= uint32(querypb.MySqlFlag_NO_DEFAULT_VALUE_FLAG)
-		if !sqltypes.FieldsEqual(fields, expectedFields) {
-			t.Fatalf("fields are not right, got:\n%v\nexpected:\n%v", fields, expectedFields)
-		}
+		require.True(t, sqltypes.FieldsEqual(fields, expectedFields), "fields are not right, got:\n%v\nexpected:\n%v", fields, expectedFields)
+
 	}
 
 	// Read the rows.
 	count := 0
 	for {
 		row, err := conn.FetchNext(nil)
-		if err != nil {
-			t.Fatalf("FetchNext failed: %v", err)
-		}
+		require.NoError(t, err, "FetchNext failed: %v", err)
+
 		if row == nil {
 			// We're done.
 			break
 		}
-		if len(row) != 2 {
-			t.Fatalf("Unexpected row found: %v", row)
-		}
+		require.Equal(t, 2, len(row), "Unexpected row found: %v", row)
+
 		count++
 	}
-	if count != expectedCount {
-		t.Errorf("Got unexpected count %v for query, was expecting %v", count, expectedCount)
-	}
+	assert.Equal(t, expectedCount, count, "Got unexpected count %v for query, was expecting %v", count, expectedCount)
+
 	conn.CloseResult()
 }
 
@@ -264,35 +244,24 @@ func doTestWarnings(t *testing.T, disableClientDeprecateEOF bool) {
 	defer conn.Close()
 
 	result, err := conn.ExecuteFetch("create table a(id int, val int not null, primary key(id))", 0, false)
-	if err != nil {
-		t.Fatalf("create table failed: %v", err)
-	}
-	if result.RowsAffected != 0 {
-		t.Errorf("create table returned RowsAffected %v, was expecting 0", result.RowsAffected)
-	}
+	require.NoError(t, err, "create table failed: %v", err)
+	assert.Equal(t, uint64(0), result.RowsAffected, "create table returned RowsAffected %v, was expecting 0", result.RowsAffected)
 
 	// Disable strict mode
 	_, err = conn.ExecuteFetch("set session sql_mode=''", 0, false)
-	if err != nil {
-		t.Fatalf("disable strict mode failed: %v", err)
-	}
+	require.NoError(t, err, "disable strict mode failed: %v", err)
 
 	// Try a simple insert with a null value
 	result, warnings, err := conn.ExecuteFetchWithWarningCount("insert into a(id) values(10)", 1000, true)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
-	if result.RowsAffected != 1 || len(result.Rows) != 0 {
-		t.Errorf("unexpected result for insert: %v", result)
-	}
-	if warnings != 1 {
-		t.Errorf("unexpected result for warnings: %v", warnings)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
+	assert.Equal(t, uint64(1), result.RowsAffected, "unexpected rows affected by insert; result: %v", result)
+	assert.Equal(t, 0, len(result.Rows), "unexpected row count in result for insert: %v", result)
+	assert.Equal(t, uint16(1), warnings, "unexpected result for warnings: %v", warnings)
 
 	_, err = conn.ExecuteFetch("drop table a", 0, false)
-	if err != nil {
-		t.Fatalf("create table failed: %v", err)
-	}
+	require.NoError(t, err, "create table failed: %v", err)
+
 }
 
 func TestWarningsDeprecateEOF(t *testing.T) {
diff --git a/go/mysql/endtoend/replication_test.go b/go/mysql/endtoend/replication_test.go
index 4376a4b9bd..9664d7a31e 100644
--- a/go/mysql/endtoend/replication_test.go
+++ b/go/mysql/endtoend/replication_test.go
@@ -25,6 +25,7 @@ import (
 	"testing"
 	"time"
 
+	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 
 	"vitess.io/vitess/go/vt/vtgate/evalengine"
@@ -64,18 +65,15 @@ func connectForReplication(t *testing.T, rbr bool) (*mysql.Conn, mysql.BinlogFor
 
 	// First we get the current binlog position.
 	result, err := conn.ExecuteFetch("SHOW MASTER STATUS", 1, true)
-	if err != nil {
-		t.Fatalf("SHOW MASTER STATUS failed: %v", err)
-	}
+	require.NoError(t, err, "SHOW MASTER STATUS failed: %v", err)
+
 	if len(result.Fields) < 2 || result.Fields[0].Name != "File" || result.Fields[1].Name != "Position" ||
 		len(result.Rows) != 1 {
 		t.Fatalf("SHOW MASTER STATUS returned unexpected result: %v", result)
 	}
 	file := result.Rows[0][0].ToString()
 	position, err := evalengine.ToUint64(result.Rows[0][1])
-	if err != nil {
-		t.Fatalf("SHOW MASTER STATUS returned invalid position: %v", result.Rows[0][1])
-	}
+	require.NoError(t, err, "SHOW MASTER STATUS returned invalid position: %v", result.Rows[0][1])
 
 	// Tell the server that we understand the format of events
 	// that will be used if binlog_checksum is enabled on the server.
@@ -92,28 +90,21 @@ func connectForReplication(t *testing.T, rbr bool) (*mysql.Conn, mysql.BinlogFor
 	var f mysql.BinlogFormat
 	for {
 		be, err := conn.ReadBinlogEvent()
-		if err != nil {
-			t.Fatalf("ReadPacket failed: %v", err)
-		}
-		if !be.IsValid() {
-			t.Fatalf("NewMysql56BinlogEvent has an invalid packet: %v", be)
-		}
+		require.NoError(t, err, "ReadPacket failed: %v", err)
+		require.True(t, be.IsValid(), "NewMysql56BinlogEvent has an invalid packet: %v", be)
 
 		// Skip rotate packets. These are normal as first packets.
 		if be.IsRotate() {
 			t.Logf("Got a rotate packet: %v", be)
 			continue
 		}
-
 		// And we want a FORMAT_DESCRIPTION_EVENT.
 		// Print a few things about the event for sanity checks.
-		if !be.IsFormatDescription() {
-			t.Fatalf("Unexpected packet: %v", be)
-		}
+		require.True(t, be.IsFormatDescription(), "Unexpected packet: %v", be)
+
 		f, err = be.Format()
-		if err != nil {
-			t.Fatalf("Format() returned error: %v", err)
-		}
+		require.NoError(t, err, "Format() returned error: %v", err)
+
 		t.Logf("Got a FORMAT_DESCRIPTION_EVENT packet: %v\nWith format: %v", be, f)
 		break
 	}
@@ -138,12 +129,9 @@ func TestReplicationConnectionClosing(t *testing.T) {
 			data, err := conn.ReadPacket()
 			if err != nil {
 				serr, ok := err.(*mysql.SQLError)
-				if !ok {
-					t.Errorf("Got a non mysql.SQLError error: %v", err)
-				}
-				if serr.Num != mysql.CRServerLost {
-					t.Errorf("Got an unexpected mysql.SQLError error: %v", serr)
-				}
+				assert.True(t, ok, "Got a non mysql.SQLError error: %v", err)
+				assert.Equal(t, mysql.CRServerLost, serr.Num, "Got an unexpected mysql.SQLError error: %v", serr)
+
 				// we got the right error, all good.
 				return
 			}
@@ -174,9 +162,8 @@ func TestReplicationConnectionClosing(t *testing.T) {
 		t.Fatal(err)
 	}
 	result, err := dConn.ExecuteFetch("insert into replicationError(id, name) values(10, 'nice name')", 0, false)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for insert: %v", result)
 	}
@@ -211,23 +198,20 @@ func TestRowReplicationWithRealDatabase(t *testing.T) {
 		t.Fatal(err)
 	}
 	result, err := dConn.ExecuteFetch("insert into replication(id, name) values(10, 'nice name')", 0, false)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for insert: %v", result)
 	}
 	result, err = dConn.ExecuteFetch("update replication set name='nicer name' where id=10", 0, false)
-	if err != nil {
-		t.Fatalf("update failed: %v", err)
-	}
+	require.NoError(t, err, "update failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for update: %v", result)
 	}
 	result, err = dConn.ExecuteFetch("delete from replication where id=10", 0, false)
-	if err != nil {
-		t.Fatalf("delete failed: %v", err)
-	}
+	require.NoError(t, err, "delete failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for delete: %v", result)
 	}
@@ -250,16 +234,12 @@ func TestRowReplicationWithRealDatabase(t *testing.T) {
 	//	for i := 0; i < 6 && (gtidCount < 2 || !gotCreateTable || !gotTableMapEvent || !gotBegin || !gotInsert || !gotCommit); i++ {
 	for gtidCount < 4 || !gotCreateTable || !gotTableMapEvent || !gotInsert || !gotUpdate || !gotDelete || beginCount != 3 || commitCount != 3 {
 		be, err := conn.ReadBinlogEvent()
-		if err != nil {
-			t.Fatalf("ReadPacket failed: %v", err)
-		}
-		if !be.IsValid() {
-			t.Fatalf("read an invalid packet: %v", be)
-		}
+		require.NoError(t, err, "ReadPacket failed: %v", err)
+		require.True(t, be.IsValid(), "read an invalid packet: %v", be)
+
 		be, _, err = be.StripChecksum(f)
-		if err != nil {
-			t.Fatalf("StripChecksum failed: %v", err)
-		}
+		require.NoError(t, err, "StripChecksum failed: %v", err)
+
 		switch {
 		case be.IsGTID():
 			// We expect one of these at least.
@@ -956,9 +936,8 @@ func TestRowReplicationTypes(t *testing.T) {
 	}
 
 	result, err := dConn.ExecuteFetch(insert, 0, false)
-	if err != nil {
-		t.Fatalf("insert failed: %v", err)
-	}
+	require.NoError(t, err, "insert failed: %v", err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for insert: %v", result)
 	}
@@ -971,16 +950,12 @@ func TestRowReplicationTypes(t *testing.T) {
 
 	for values == nil {
 		be, err := conn.ReadBinlogEvent()
-		if err != nil {
-			t.Fatalf("ReadPacket failed: %v", err)
-		}
-		if !be.IsValid() {
-			t.Fatalf("read an invalid packet: %v", be)
-		}
+		require.NoError(t, err, "ReadPacket failed: %v", err)
+		require.True(t, be.IsValid(), "read an invalid packet: %v", be)
+
 		be, _, err = be.StripChecksum(f)
-		if err != nil {
-			t.Fatalf("StripChecksum failed: %v", err)
-		}
+		require.NoError(t, err, "StripChecksum failed: %v", err)
+
 		switch {
 		case be.IsTableMap():
 			tableID = be.TableID(f) // This would be 0x00ffffff for an event to clear all table map entries.
@@ -1048,9 +1023,8 @@ func TestRowReplicationTypes(t *testing.T) {
 		}
 	}
 	result, err = dConn.ExecuteFetch(sql.String(), 0, false)
-	if err != nil {
-		t.Fatalf("insert '%v' failed: %v", sql.String(), err)
-	}
+	require.NoError(t, err, "insert '%v' failed: %v", sql.String(), err)
+
 	if result.RowsAffected != 1 || len(result.Rows) != 0 {
 		t.Errorf("unexpected result for insert: %v", result)
 	}
@@ -1063,16 +1037,12 @@ func TestRowReplicationTypes(t *testing.T) {
 	}
 	stmt += " from replicationtypes"
 	result, err = dConn.ExecuteFetch(stmt, 2, false)
-	if err != nil {
-		t.Fatalf("select failed: %v", err)
-	}
-	if len(result.Rows) != 2 {
-		t.Fatalf("unexpected result for select: %v", result)
-	}
+	require.NoError(t, err, "select failed: %v", err)
+	require.Equal(t, 2, len(result.Rows), "unexpected result for select: %v", result)
+
 	for i, tcase := range testcases {
-		if !reflect.DeepEqual(result.Rows[0][i+1], result.Rows[1][i+1]) {
-			t.Errorf("Field %v is not the same, got %v and %v", tcase.name, result.Rows[0][i+1], result.Rows[1][i+1])
-		}
+		assert.True(t, reflect.DeepEqual(result.Rows[0][i+1], result.Rows[1][i+1]), "Field %v is not the same, got %v and %v", tcase.name, result.Rows[0][i+1], result.Rows[1][i+1])
+
 	}
 
 	// Drop the table, we're done.
diff --git a/go/mysql/flavor_mariadb_test.go b/go/mysql/flavor_mariadb_test.go
index 0198b8095d..3739e9294c 100644
--- a/go/mysql/flavor_mariadb_test.go
+++ b/go/mysql/flavor_mariadb_test.go
@@ -42,9 +42,8 @@ func TestMariadbSetReplicationSourceCommand(t *testing.T) {
 
 	conn := &Conn{flavor: mariadbFlavor101{}}
 	got := conn.SetReplicationSourceCommand(params, host, port, connectRetry)
-	if got != want {
-		t.Errorf("mariadbFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
-	}
+	assert.Equal(t, want, got, "mariadbFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
+
 }
 
 func TestMariadbSetReplicationSourceCommandSSL(t *testing.T) {
@@ -75,9 +74,8 @@ func TestMariadbSetReplicationSourceCommandSSL(t *testing.T) {
 
 	conn := &Conn{flavor: mariadbFlavor101{}}
 	got := conn.SetReplicationSourceCommand(params, host, port, connectRetry)
-	if got != want {
-		t.Errorf("mariadbFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
-	}
+	assert.Equal(t, want, got, "mariadbFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
+
 }
 
 func TestMariadbRetrieveSourceServerId(t *testing.T) {
diff --git a/go/mysql/flavor_mysql_test.go b/go/mysql/flavor_mysql_test.go
index bf390427e6..33b98cb494 100644
--- a/go/mysql/flavor_mysql_test.go
+++ b/go/mysql/flavor_mysql_test.go
@@ -41,9 +41,8 @@ func TestMysql56SetReplicationSourceCommand(t *testing.T) {
 
 	conn := &Conn{flavor: mysqlFlavor57{}}
 	got := conn.SetReplicationSourceCommand(params, host, port, connectRetry)
-	if got != want {
-		t.Errorf("mysqlFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
-	}
+	assert.Equal(t, want, got, "mysqlFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
+
 }
 
 func TestMysql56SetReplicationSourceCommandSSL(t *testing.T) {
@@ -74,9 +73,8 @@ func TestMysql56SetReplicationSourceCommandSSL(t *testing.T) {
 
 	conn := &Conn{flavor: mysqlFlavor57{}}
 	got := conn.SetReplicationSourceCommand(params, host, port, connectRetry)
-	if got != want {
-		t.Errorf("mysqlFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
-	}
+	assert.Equal(t, want, got, "mysqlFlavor.SetReplicationSourceCommand(%#v, %#v, %#v, %#v) = %#v, want %#v", params, host, port, connectRetry, got, want)
+
 }
 
 func TestMysqlRetrieveSourceServerId(t *testing.T) {
diff --git a/go/mysql/gtid_test.go b/go/mysql/gtid_test.go
index ded8b727a7..8dfea64172 100644
--- a/go/mysql/gtid_test.go
+++ b/go/mysql/gtid_test.go
@@ -19,6 +19,8 @@ package mysql
 import (
 	"strings"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestParseGTID(t *testing.T) {
@@ -30,12 +32,9 @@ func TestParseGTID(t *testing.T) {
 	want := fakeGTID{value: "12345"}
 
 	got, err := ParseGTID(flavor, input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("ParseGTID(%#v, %#v) = %#v, want %#v", flavor, input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "ParseGTID(%#v, %#v) = %#v, want %#v", flavor, input, got, want)
+
 }
 
 func TestMustParseGTID(t *testing.T) {
@@ -47,18 +46,16 @@ func TestMustParseGTID(t *testing.T) {
 	want := fakeGTID{value: "12345"}
 
 	got := MustParseGTID(flavor, input)
-	if got != want {
-		t.Errorf("MustParseGTID(%#v, %#v) = %#v, want %#v", flavor, input, got, want)
-	}
+	assert.Equal(t, want, got, "MustParseGTID(%#v, %#v) = %#v, want %#v", flavor, input, got, want)
+
 }
 
 func TestMustParseGTIDError(t *testing.T) {
 	defer func() {
 		want := `parse error: unknown GTID flavor "unknown flavor !@$!@"`
 		err := recover()
-		if err == nil {
-			t.Errorf("wrong error, got %#v, want %#v", err, want)
-		}
+		assert.NotNil(t, err, "wrong error, got %#v, want %#v", err, want)
+
 		got, ok := err.(error)
 		if !ok || !strings.HasPrefix(got.Error(), want) {
 			t.Errorf("wrong error, got %#v, want %#v", got, want)
@@ -72,9 +69,8 @@ func TestParseUnknownFlavor(t *testing.T) {
 	want := `parse error: unknown GTID flavor "foobar8675309"`
 
 	_, err := ParseGTID("foobar8675309", "foo")
-	if !strings.HasPrefix(err.Error(), want) {
-		t.Errorf("wrong error, got '%v', want '%v'", err, want)
-	}
+	assert.True(t, strings.HasPrefix(err.Error(), want), "wrong error, got '%v', want '%v'", err, want)
+
 }
 
 func TestEncodeGTID(t *testing.T) {
@@ -97,12 +93,9 @@ func TestDecodeGTID(t *testing.T) {
 	want := fakeGTID{value: "123-456:789"}
 
 	got, err := DecodeGTID(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("DecodeGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "DecodeGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestMustDecodeGTID(t *testing.T) {
@@ -113,18 +106,16 @@ func TestMustDecodeGTID(t *testing.T) {
 	want := fakeGTID{value: "123-456:789"}
 
 	got := MustDecodeGTID(input)
-	if got != want {
-		t.Errorf("DecodeGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.Equal(t, want, got, "DecodeGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestMustDecodeGTIDError(t *testing.T) {
 	defer func() {
 		want := `parse error: unknown GTID flavor "unknown flavor !@$!@"`
 		err := recover()
-		if err == nil {
-			t.Errorf("wrong error, got %#v, want %#v", err, want)
-		}
+		assert.NotNil(t, err, "wrong error, got %#v, want %#v", err, want)
+
 		got, ok := err.(error)
 		if !ok || !strings.HasPrefix(got.Error(), want) {
 			t.Errorf("wrong error, got %#v, want %#v", got, want)
@@ -148,12 +139,9 @@ func TestDecodeNilGTID(t *testing.T) {
 	want := GTID(nil)
 
 	got, err := DecodeGTID(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("DecodeGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "DecodeGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestDecodeNoFlavor(t *testing.T) {
@@ -164,12 +152,9 @@ func TestDecodeNoFlavor(t *testing.T) {
 	want := fakeGTID{value: "12345"}
 
 	got, err := DecodeGTID(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("DecodeGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "DecodeGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestDecodeGTIDWithSeparator(t *testing.T) {
@@ -180,12 +165,9 @@ func TestDecodeGTIDWithSeparator(t *testing.T) {
 	want := fakeGTID{value: "GTID containing / a slash"}
 
 	got, err := DecodeGTID(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("DecodeGTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "DecodeGTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 type fakeGTID struct {
diff --git a/go/mysql/handshake_test.go b/go/mysql/handshake_test.go
index 3948fe851b..57435284cb 100644
--- a/go/mysql/handshake_test.go
+++ b/go/mysql/handshake_test.go
@@ -24,6 +24,9 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+
 	"vitess.io/vitess/go/test/utils"
 
 	"vitess.io/vitess/go/vt/tlstest"
@@ -43,9 +46,7 @@ func TestClearTextClientAuth(t *testing.T) {
 
 	// Create the listener.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -72,16 +73,14 @@ func TestClearTextClientAuth(t *testing.T) {
 	// Change server side to allow clear text without auth.
 	l.AllowClearTextWithoutTLS.Set(true)
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("unexpected connection error: %v", err)
-	}
+	require.NoError(t, err, "unexpected connection error: %v", err)
+
 	defer conn.Close()
 
 	// Run a 'select rows' command with results.
 	result, err := conn.ExecuteFetch("select rows", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+
 	utils.MustMatch(t, result, selectRowsResult)
 
 	// Send a ComQuit to avoid the error message on the server side.
@@ -101,9 +100,7 @@ func TestSSLConnection(t *testing.T) {
 
 	// Create the listener, so we can get its host.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -122,9 +119,8 @@ func TestSSLConnection(t *testing.T) {
 		"",
 		"",
 		tls.VersionTLS12)
-	if err != nil {
-		t.Fatalf("TLSServerConfig failed: %v", err)
-	}
+	require.NoError(t, err, "TLSServerConfig failed: %v", err)
+
 	l.TLSConfig.Store(serverConfig)
 	go func() {
 		l.Accept()
@@ -158,22 +154,15 @@ func testSSLConnectionClearText(t *testing.T, params *ConnParams) {
 	// Create a client connection, connect.
 	ctx := context.Background()
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("Connect failed: %v", err)
-	}
+	require.NoError(t, err, "Connect failed: %v", err)
+
 	defer conn.Close()
-	if conn.User != "user1" {
-		t.Errorf("Invalid conn.User, got %v was expecting user1", conn.User)
-	}
+	assert.Equal(t, "user1", conn.User, "Invalid conn.User, got %v was expecting user1", conn.User)
 
 	// Make sure this went through SSL.
 	result, err := conn.ExecuteFetch("ssl echo", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
-	if result.Rows[0][0].ToString() != "ON" {
-		t.Errorf("Got wrong result from ExecuteFetch(ssl echo): %v", result)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+	assert.Equal(t, "ON", result.Rows[0][0].ToString(), "Got wrong result from ExecuteFetch(ssl echo): %v", result)
 
 	// Send a ComQuit to avoid the error message on the server side.
 	conn.writeComQuit()
@@ -183,29 +172,21 @@ func testSSLConnectionBasics(t *testing.T, params *ConnParams) {
 	// Create a client connection, connect.
 	ctx := context.Background()
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("Connect failed: %v", err)
-	}
+	require.NoError(t, err, "Connect failed: %v", err)
+
 	defer conn.Close()
-	if conn.User != "user1" {
-		t.Errorf("Invalid conn.User, got %v was expecting user1", conn.User)
-	}
+	assert.Equal(t, "user1", conn.User, "Invalid conn.User, got %v was expecting user1", conn.User)
 
 	// Run a 'select rows' command with results.
 	result, err := conn.ExecuteFetch("select rows", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+
 	utils.MustMatch(t, result, selectRowsResult)
 
 	// Make sure this went through SSL.
 	result, err = conn.ExecuteFetch("ssl echo", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
-	if result.Rows[0][0].ToString() != "ON" {
-		t.Errorf("Got wrong result from ExecuteFetch(ssl echo): %v", result)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+	assert.Equal(t, "ON", result.Rows[0][0].ToString(), "Got wrong result from ExecuteFetch(ssl echo): %v", result)
 
 	// Send a ComQuit to avoid the error message on the server side.
 	conn.writeComQuit()
diff --git a/go/mysql/ldapauthserver/auth_server_ldap_test.go b/go/mysql/ldapauthserver/auth_server_ldap_test.go
index 8658536d5b..245ad98727 100644
--- a/go/mysql/ldapauthserver/auth_server_ldap_test.go
+++ b/go/mysql/ldapauthserver/auth_server_ldap_test.go
@@ -20,6 +20,7 @@ import (
 	"fmt"
 	"testing"
 
+	"github.com/stretchr/testify/require"
 	ldap "gopkg.in/ldap.v2"
 )
 
@@ -46,12 +47,9 @@ func TestValidateClearText(t *testing.T) {
 		RefreshSeconds: 1,
 	}
 	_, err := asl.validate("testuser", "testpass")
-	if err != nil {
-		t.Fatalf("AuthServerLdap failed to validate valid credentials. Got: %v", err)
-	}
+	require.NoError(t, err, "AuthServerLdap failed to validate valid credentials. Got: %v", err)
 
 	_, err = asl.validate("invaliduser", "invalidpass")
-	if err == nil {
-		t.Fatalf("AuthServerLdap validated invalid credentials.")
-	}
+	require.Error(t, err, "AuthServerLdap validated invalid credentials.")
+
 }
diff --git a/go/mysql/mariadb_gtid_test.go b/go/mysql/mariadb_gtid_test.go
index efecfb8b44..49472ab8d3 100644
--- a/go/mysql/mariadb_gtid_test.go
+++ b/go/mysql/mariadb_gtid_test.go
@@ -29,12 +29,9 @@ func TestParseMariaGTID(t *testing.T) {
 	want := MariadbGTID{Domain: 12, Server: 345, Sequence: 6789}
 
 	got, err := parseMariadbGTID(input)
-	if err != nil {
-		t.Errorf("%v", err)
-	}
-	if got.(MariadbGTID) != want {
-		t.Errorf("parseMariadbGTID(%v) = %v, want %v", input, got, want)
-	}
+	assert.NoError(t, err, "%v", err)
+	assert.Equal(t, want, got.(MariadbGTID), "parseMariadbGTID(%v) = %v, want %v", input, got, want)
+
 }
 
 func TestParseInvalidMariaGTID(t *testing.T) {
@@ -42,12 +39,9 @@ func TestParseInvalidMariaGTID(t *testing.T) {
 	want := "invalid MariaDB GTID"
 
 	_, err := parseMariadbGTID(input)
-	if err == nil {
-		t.Errorf("expected error for invalid input (%v)", input)
-	}
-	if !strings.HasPrefix(err.Error(), want) {
-		t.Errorf("wrong error message, got '%v', want '%v'", err, want)
-	}
+	assert.Error(t, err, "expected error for invalid input (%v)", input)
+	assert.True(t, strings.HasPrefix(err.Error(), want), "wrong error message, got '%v', want '%v'", err, want)
+
 }
 
 func TestParseMariaGTIDInvalidDomain(t *testing.T) {
@@ -55,12 +49,9 @@ func TestParseMariaGTIDInvalidDomain(t *testing.T) {
 	want := "invalid MariaDB GTID Domain ID"
 
 	_, err := parseMariadbGTID(input)
-	if err == nil {
-		t.Errorf("expected error for invalid input (%v)", input)
-	}
-	if !strings.HasPrefix(err.Error(), want) {
-		t.Errorf("wrong error message, got '%v', want '%v'", err, want)
-	}
+	assert.Error(t, err, "expected error for invalid input (%v)", input)
+	assert.True(t, strings.HasPrefix(err.Error(), want), "wrong error message, got '%v', want '%v'", err, want)
+
 }
 
 func TestParseMariaGTIDInvalidServer(t *testing.T) {
@@ -68,12 +59,9 @@ func TestParseMariaGTIDInvalidServer(t *testing.T) {
 	want := "invalid MariaDB GTID Server ID"
 
 	_, err := parseMariadbGTID(input)
-	if err == nil {
-		t.Errorf("expected error for invalid input (%v)", input)
-	}
-	if !strings.HasPrefix(err.Error(), want) {
-		t.Errorf("wrong error message, got '%v', want '%v'", err, want)
-	}
+	assert.Error(t, err, "expected error for invalid input (%v)", input)
+	assert.True(t, strings.HasPrefix(err.Error(), want), "wrong error message, got '%v', want '%v'", err, want)
+
 }
 
 func TestParseMariaGTIDInvalidSequence(t *testing.T) {
@@ -81,12 +69,9 @@ func TestParseMariaGTIDInvalidSequence(t *testing.T) {
 	want := "invalid MariaDB GTID Sequence number"
 
 	_, err := parseMariadbGTID(input)
-	if err == nil {
-		t.Errorf("expected error for invalid input (%v)", input)
-	}
-	if !strings.HasPrefix(err.Error(), want) {
-		t.Errorf("wrong error message, got '%v', want '%v'", err, want)
-	}
+	assert.Error(t, err, "expected error for invalid input (%v)", input)
+	assert.True(t, strings.HasPrefix(err.Error(), want), "wrong error message, got '%v', want '%v'", err, want)
+
 }
 
 func TestParseMariaGTIDSet(t *testing.T) {
@@ -97,12 +82,9 @@ func TestParseMariaGTIDSet(t *testing.T) {
 	}
 
 	got, err := parseMariadbGTIDSet(input)
-	if err != nil {
-		t.Errorf("%v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("parseMariadbGTIDSet(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "%v", err)
+	assert.True(t, got.Equal(want), "parseMariadbGTIDSet(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestParseInvalidMariaGTIDSet(t *testing.T) {
@@ -124,9 +106,8 @@ func TestMariaGTIDString(t *testing.T) {
 	want := "5-4727-1737373"
 
 	got := input.String()
-	if got != want {
-		t.Errorf("%#v.String() = '%v', want '%v'", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.String() = '%v', want '%v'", input, got, want)
+
 }
 
 func TestMariaGTIDFlavor(t *testing.T) {
@@ -134,9 +115,8 @@ func TestMariaGTIDFlavor(t *testing.T) {
 	want := "MariaDB"
 
 	got := input.Flavor()
-	if got != want {
-		t.Errorf("%#v.Flavor() = '%v', want '%v'", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.Flavor() = '%v', want '%v'", input, got, want)
+
 }
 
 func TestMariaGTIDSequenceDomain(t *testing.T) {
@@ -144,9 +124,8 @@ func TestMariaGTIDSequenceDomain(t *testing.T) {
 	want := any(uint32(12))
 
 	got := input.SequenceDomain()
-	if got != want {
-		t.Errorf("%#v.SequenceDomain() = %#v, want %#v", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.SequenceDomain() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariaGTIDSourceServer(t *testing.T) {
@@ -154,9 +133,8 @@ func TestMariaGTIDSourceServer(t *testing.T) {
 	want := any(uint32(345))
 
 	got := input.SourceServer()
-	if got != want {
-		t.Errorf("%#v.SourceServer() = %#v, want %#v", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.SourceServer() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariaGTIDSequenceNumber(t *testing.T) {
@@ -164,9 +142,8 @@ func TestMariaGTIDSequenceNumber(t *testing.T) {
 	want := any(uint64(6789))
 
 	got := input.SequenceNumber()
-	if got != want {
-		t.Errorf("%#v.SequenceNumber() = %#v, want %#v", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.SequenceNumber() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariaGTIDGTIDSet(t *testing.T) {
@@ -174,9 +151,8 @@ func TestMariaGTIDGTIDSet(t *testing.T) {
 	want := MariadbGTIDSet{12: input}
 
 	got := input.GTIDSet()
-	if !got.Equal(want) {
-		t.Errorf("%#v.GTIDSet() = %#v, want %#v", input, got, want)
-	}
+	assert.True(t, got.Equal(want), "%#v.GTIDSet() = %#v, want %#v", input, got, want)
+
 }
 
 func TestMariaGTIDSetString(t *testing.T) {
@@ -188,9 +164,8 @@ func TestMariaGTIDSetString(t *testing.T) {
 	want := "1-1234-5678,3-4321-9876,5-4727-1737373"
 
 	got := input.String()
-	if got != want {
-		t.Errorf("%#v.String() = '%v', want '%v'", input, got, want)
-	}
+	assert.Equal(t, want, got, "%#v.String() = '%v', want '%v'", input, got, want)
+
 }
 
 func TestMariaGTIDSetContainsLess(t *testing.T) {
@@ -601,10 +576,8 @@ func TestMariaGTIDSetUnion(t *testing.T) {
 		4: MariadbGTID{Domain: 4, Server: 1, Sequence: 2},
 		5: MariadbGTID{Domain: 5, Server: 1, Sequence: 4},
 	}
+	assert.True(t, got.Equal(want), "set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
 
-	if !got.Equal(want) {
-		t.Errorf("set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
-	}
 }
 
 func TestMariaGTIDSetUnionNewDomain(t *testing.T) {
@@ -628,10 +601,7 @@ func TestMariaGTIDSetUnionNewDomain(t *testing.T) {
 		5: MariadbGTID{Domain: 5, Server: 1, Sequence: 4},
 		6: MariadbGTID{Domain: 6, Server: 1, Sequence: 7},
 	}
-
-	if !got.Equal(want) {
-		t.Errorf("set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
-	}
+	assert.True(t, got.Equal(want), "set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
 
 	switch g := got.(type) {
 	case MariadbGTIDSet:
diff --git a/go/mysql/mysql56_gtid_set_test.go b/go/mysql/mysql56_gtid_set_test.go
index 99730e3802..ec03679a77 100644
--- a/go/mysql/mysql56_gtid_set_test.go
+++ b/go/mysql/mysql56_gtid_set_test.go
@@ -23,6 +23,7 @@ import (
 	"testing"
 
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 func TestSortSIDList(t *testing.T) {
@@ -43,9 +44,7 @@ func TestSortSIDList(t *testing.T) {
 		{1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
 	}
 	sortSIDs(input)
-	if !reflect.DeepEqual(input, want) {
-		t.Errorf("got %#v, want %#v", input, want)
-	}
+	assert.True(t, reflect.DeepEqual(input, want), "got %#v, want %#v", input, want)
 }
 
 func TestParseMysql56GTIDSet(t *testing.T) {
@@ -98,9 +97,7 @@ func TestParseMysql56GTIDSet(t *testing.T) {
 			t.Errorf("unexpected error: %v", err)
 			continue
 		}
-		if !got.Equal(want) {
-			t.Errorf("ParseMysql56GTIDSet(%#v) = %#v, want %#v", input, got, want)
-		}
+		assert.True(t, got.Equal(want), "parseMysql56GTIDSet(%#v) = %#v, want %#v", input, got, want)
 	}
 }
 
@@ -119,9 +116,7 @@ func TestParseMysql56GTIDSetInvalid(t *testing.T) {
 
 	for _, input := range table {
 		_, err := ParseMysql56GTIDSet(input)
-		if err == nil {
-			t.Errorf("ParseMysql56GTIDSet(%#v) expected error, got none", err)
-		}
+		assert.Error(t, err, "parseMysql56GTIDSet(%#v) expected error, got none", err)
 	}
 }
 
@@ -151,9 +146,8 @@ func TestMysql56GTIDSetString(t *testing.T) {
 
 	for want, input := range table {
 		got := strings.ToLower(input.String())
-		if got != want {
-			t.Errorf("%#v.String() = %#v, want %#v", input, got, want)
-		}
+		assert.Equal(t, want, got, "%#v.String() = %#v, want %#v", input, got, want)
+
 	}
 }
 
@@ -229,9 +223,8 @@ func TestMysql56GTIDSetContains(t *testing.T) {
 	}
 
 	for _, other := range contained {
-		if !set.Contains(other) {
-			t.Errorf("Contains(%#v) = false, want true", other)
-		}
+		assert.True(t, set.Contains(other), "Contains(%#v) = false, want true", other)
+
 	}
 
 	// Test cases that should return Contains() = false.
@@ -288,13 +281,10 @@ func TestMysql56GTIDSetEqual(t *testing.T) {
 	}
 
 	for _, other := range equal {
-		if !set.Equal(other) {
-			t.Errorf("%#v.Equal(%#v) = false, want true", set, other)
-		}
+		assert.True(t, set.Equal(other), "%#v.Equal(%#v) = false, want true", set, other)
 		// Equality should be transitive.
-		if !other.Equal(set) {
-			t.Errorf("%#v.Equal(%#v) = false, want true", other, set)
-		}
+		assert.True(t, other.Equal(set), "%#v.Equal(%#v) = false, want true", other, set)
+
 	}
 
 	// Test cases that should return Equal() = false.
@@ -442,10 +432,8 @@ func TestMysql56GTIDSetUnion(t *testing.T) {
 		sid2: []interval{{1, 6}, {20, 50}, {60, 72}},
 		sid3: []interval{{1, 45}},
 	}
+	assert.True(t, got.Equal(want), "set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
 
-	if !got.Equal(want) {
-		t.Errorf("set1: %#v, set1.Union(%#v) = %#v, want %#v", set1, set2, got, want)
-	}
 }
 
 func TestMysql56GTIDSetDifference(t *testing.T) {
@@ -477,10 +465,7 @@ func TestMysql56GTIDSetDifference(t *testing.T) {
 		sid4: []interval{{1, 30}},
 		sid5: []interval{{1, 1}, {7, 7}},
 	}
-
-	if !got.Equal(want) {
-		t.Errorf("got %#v; want %#v", got, want)
-	}
+	assert.True(t, got.Equal(want), "got %#v; want %#v", got, want)
 
 	sid10 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
 	sid11 := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
@@ -492,9 +477,8 @@ func TestMysql56GTIDSetDifference(t *testing.T) {
 	}
 	got = set10.Difference(set11)
 	want = Mysql56GTIDSet{}
-	if !got.Equal(want) {
-		t.Errorf("got %#v; want %#v", got, want)
-	}
+	assert.True(t, got.Equal(want), "got %#v; want %#v", got, want)
+
 }
 
 func TestMysql56GTIDSetSIDBlock(t *testing.T) {
@@ -530,18 +514,13 @@ func TestMysql56GTIDSetSIDBlock(t *testing.T) {
 		6, 0, 0, 0, 0, 0, 0, 0,
 	}
 	got := input.SIDBlock()
-	if !reflect.DeepEqual(got, want) {
-		t.Errorf("%#v.SIDBlock() = %#v, want %#v", input, got, want)
-	}
+	assert.True(t, reflect.DeepEqual(got, want), "%#v.SIDBlock() = %#v, want %#v", input, got, want)
 
 	// Testing the conversion back.
 	set, err := NewMysql56GTIDSetFromSIDBlock(want)
-	if err != nil {
-		t.Fatalf("Reconstructing Mysql56GTIDSet from SID block failed: %v", err)
-	}
-	if !reflect.DeepEqual(set, input) {
-		t.Errorf("NewMysql56GTIDSetFromSIDBlock(%#v) = %#v, want %#v", want, set, input)
-	}
+	require.NoError(t, err, "Reconstructing Mysql56GTIDSet from SID block failed: %v", err)
+	assert.True(t, reflect.DeepEqual(set, input), "NewMysql56GTIDSetFromSIDBlock(%#v) = %#v, want %#v", want, set, input)
+
 }
 
 func TestMySQL56GTIDSetLast(t *testing.T) {
diff --git a/go/mysql/mysql56_gtid_test.go b/go/mysql/mysql56_gtid_test.go
index 9ea8363645..335835d819 100644
--- a/go/mysql/mysql56_gtid_test.go
+++ b/go/mysql/mysql56_gtid_test.go
@@ -19,6 +19,9 @@ package mysql
 import (
 	"strings"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 func TestParseMysql56GTID(t *testing.T) {
@@ -29,12 +32,9 @@ func TestParseMysql56GTID(t *testing.T) {
 	}
 
 	got, err := parseMysql56GTID(input)
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("parseMysql56GTID(%#v) = %#v, want %#v", input, got, want)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "parseMysql56GTID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestParseMysql56GTIDInvalid(t *testing.T) {
@@ -48,9 +48,8 @@ func TestParseMysql56GTIDInvalid(t *testing.T) {
 
 	for _, input := range table {
 		_, err := parseMysql56GTID(input)
-		if err == nil {
-			t.Errorf("parseMysql56GTID(%#v): expected error, got none", input)
-		}
+		assert.Error(t, err, "parseMysql56GTID(%#v): expected error, got none", input)
+
 	}
 }
 
@@ -68,12 +67,9 @@ func TestParseSID(t *testing.T) {
 	want := SID{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}
 
 	got, err := ParseSID(input)
-	if err != nil {
-		t.Fatalf("unexpected error: %v", err)
-	}
-	if got != want {
-		t.Errorf("ParseSID(%#v) = %#v, want %#v", input, got, want)
-	}
+	require.NoError(t, err, "unexpected error: %v", err)
+	assert.Equal(t, want, got, "ParseSID(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestParseSIDInvalid(t *testing.T) {
@@ -86,9 +82,8 @@ func TestParseSIDInvalid(t *testing.T) {
 
 	for _, input := range table {
 		_, err := ParseSID(input)
-		if err == nil {
-			t.Errorf("ParseSID(%#v): expected error, got none", input)
-		}
+		assert.Error(t, err, "ParseSID(%#v): expected error, got none", input)
+
 	}
 }
 
diff --git a/go/mysql/query_test.go b/go/mysql/query_test.go
index 5fdcbc8c83..89c5aabea0 100644
--- a/go/mysql/query_test.go
+++ b/go/mysql/query_test.go
@@ -91,9 +91,8 @@ func TestComInitDB(t *testing.T) {
 		t.Fatalf("sConn.ReadPacket - ComInitDB failed: %v %v", data, err)
 	}
 	db := sConn.parseComInitDB(data)
-	if db != "my_db" {
-		t.Errorf("parseComInitDB returned unexpected data: %v", db)
-	}
+	assert.Equal(t, "my_db", db, "parseComInitDB returned unexpected data: %v", db)
+
 }
 
 func TestComSetOption(t *testing.T) {
@@ -113,12 +112,9 @@ func TestComSetOption(t *testing.T) {
 		t.Fatalf("sConn.ReadPacket - ComSetOption failed: %v %v", data, err)
 	}
 	operation, ok := sConn.parseComSetOption(data)
-	if !ok {
-		t.Fatalf("parseComSetOption failed unexpectedly")
-	}
-	if operation != 1 {
-		t.Errorf("parseComSetOption returned unexpected data: %v", operation)
-	}
+	require.True(t, ok, "parseComSetOption failed unexpectedly")
+	assert.Equal(t, uint16(1), operation, "parseComSetOption returned unexpected data: %v", operation)
+
 }
 
 func TestComStmtPrepare(t *testing.T) {
@@ -137,14 +133,10 @@ func TestComStmtPrepare(t *testing.T) {
 	}
 
 	data, err := sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - ComPrepare failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - ComPrepare failed: %v", err)
 
 	parsedQuery := sConn.parseComPrepare(data)
-	if parsedQuery != sql {
-		t.Fatalf("Received incorrect query, want: %v, got: %v", sql, parsedQuery)
-	}
+	require.Equal(t, sql, parsedQuery, "Received incorrect query, want: %v, got: %v", sql, parsedQuery)
 
 	prepare, result := MockPrepareData(t)
 	sConn.PrepareData = make(map[uint32]*PrepareData)
@@ -156,12 +148,9 @@ func TestComStmtPrepare(t *testing.T) {
 	}
 
 	resp, err := cConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("cConn.ReadPacket failed: %v", err)
-	}
-	if uint32(resp[1]) != prepare.StatementID {
-		t.Fatalf("Received incorrect Statement ID, want: %v, got: %v", prepare.StatementID, resp[1])
-	}
+	require.NoError(t, err, "cConn.ReadPacket failed: %v", err)
+	require.Equal(t, prepare.StatementID, uint32(resp[1]), "Received incorrect Statement ID, want: %v, got: %v", prepare.StatementID, resp[1])
+
 }
 
 func TestComStmtPrepareUpdStmt(t *testing.T) {
@@ -229,20 +218,13 @@ func TestComStmtSendLongData(t *testing.T) {
 		t.Fatalf("sConn.ReadPacket - ComStmtClose failed: %v %v", data, err)
 	}
 	stmtID, paramID, chunkData, ok := sConn.parseComStmtSendLongData(data)
-	if !ok {
-		t.Fatalf("parseComStmtSendLongData failed")
-	}
-	if paramID != 1 {
-		t.Fatalf("Received incorrect ParamID, want %v, got %v:", paramID, 1)
-	}
-	if stmtID != prepare.StatementID {
-		t.Fatalf("Received incorrect value, want: %v, got: %v", uint32(data[1]), prepare.StatementID)
-	}
+	require.True(t, ok, "parseComStmtSendLongData failed")
+	require.Equal(t, uint16(1), paramID, "Received incorrect ParamID, want %v, got %v:", paramID, 1)
+	require.Equal(t, prepare.StatementID, stmtID, "Received incorrect value, want: %v, got: %v", uint32(data[1]), prepare.StatementID)
 	// Check length of chunkData, Since its a subset of `data` and compare with it after we subtract the number of bytes that was read from it.
 	// sizeof(uint32) + sizeof(uint16) + 1 = 7
-	if len(chunkData) != len(data)-7 {
-		t.Fatalf("Received bad chunkData")
-	}
+	require.Equal(t, len(data)-7, len(chunkData), "Received bad chunkData")
+
 }
 
 func TestComStmtExecute(t *testing.T) {
@@ -261,12 +243,9 @@ func TestComStmtExecute(t *testing.T) {
 	data := []byte{23, 18, 0, 0, 0, 128, 1, 0, 0, 0, 0, 1, 1, 128, 1}
 
 	stmtID, _, err := sConn.parseComStmtExecute(cConn.PrepareData, data)
-	if err != nil {
-		t.Fatalf("parseComStmtExeute failed: %v", err)
-	}
-	if stmtID != 18 {
-		t.Fatalf("Parsed incorrect values")
-	}
+	require.NoError(t, err, "parseComStmtExeute failed: %v", err)
+	require.Equal(t, uint32(18), stmtID, "Parsed incorrect values")
+
 }
 
 func TestComStmtExecuteUpdStmt(t *testing.T) {
@@ -367,12 +346,9 @@ func TestComStmtClose(t *testing.T) {
 		t.Fatalf("sConn.ReadPacket - ComStmtClose failed: %v %v", data, err)
 	}
 	stmtID, ok := sConn.parseComStmtClose(data)
-	if !ok {
-		t.Fatalf("parseComStmtClose failed")
-	}
-	if stmtID != prepare.StatementID {
-		t.Fatalf("Received incorrect value, want: %v, got: %v", uint32(data[1]), prepare.StatementID)
-	}
+	require.True(t, ok, "parseComStmtClose failed")
+	require.Equal(t, prepare.StatementID, stmtID, "Received incorrect value, want: %v, got: %v", uint32(data[1]), prepare.StatementID)
+
 }
 
 func TestQueries(t *testing.T) {
@@ -746,16 +722,13 @@ func checkQueryInternal(t *testing.T, query string, sConn, cConn *Conn, result *
 
 	for i := 0; i < count; i++ {
 		kontinue := sConn.handleNextCommand(&handler)
-		if !kontinue {
-			t.Fatalf("error handling command: %d", i)
-		}
+		require.True(t, kontinue, "error handling command: %d", i)
+
 	}
 
 	wg.Wait()
+	require.Equal(t, "", fatalError, fatalError)
 
-	if fatalError != "" {
-		t.Fatalf(fatalError)
-	}
 }
 
 // nolint
diff --git a/go/mysql/replication_position_test.go b/go/mysql/replication_position_test.go
index b8b6379392..5bb2e5385d 100644
--- a/go/mysql/replication_position_test.go
+++ b/go/mysql/replication_position_test.go
@@ -20,6 +20,8 @@ import (
 	"encoding/json"
 	"strings"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
 )
 
 func TestPositionEqual(t *testing.T) {
@@ -225,9 +227,8 @@ func TestMustParsePositionError(t *testing.T) {
 	defer func() {
 		want := `parse error: unknown GTIDSet flavor "unknown flavor !@$!@"`
 		err := recover()
-		if err == nil {
-			t.Errorf("wrong error, got %#v, want %#v", err, want)
-		}
+		assert.NotNil(t, err, "wrong error, got %#v, want %#v", err, want)
+
 		got, ok := err.(error)
 		if !ok || !strings.HasPrefix(got.Error(), want) {
 			t.Errorf("wrong error, got %#v, want %#v", got, want)
@@ -266,12 +267,9 @@ func TestDecodePosition(t *testing.T) {
 	want := Position{GTIDSet: fakeGTID{value: "123-456:789"}}
 
 	got, err := DecodePosition(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("DecodePosition(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "DecodePosition(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestDecodePositionZero(t *testing.T) {
@@ -279,12 +277,9 @@ func TestDecodePositionZero(t *testing.T) {
 	want := Position{}
 
 	got, err := DecodePosition(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("DecodePosition(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "DecodePosition(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestDecodePositionNoFlavor(t *testing.T) {
@@ -295,12 +290,9 @@ func TestDecodePositionNoFlavor(t *testing.T) {
 	want := Position{GTIDSet: fakeGTID{value: "12345"}}
 
 	got, err := DecodePosition(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("DecodePosition(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "DecodePosition(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestJsonMarshalPosition(t *testing.T) {
@@ -308,9 +300,7 @@ func TestJsonMarshalPosition(t *testing.T) {
 	want := `"golf/par"`
 
 	buf, err := json.Marshal(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
 
 	if got := string(buf); got != want {
 		t.Errorf("json.Marshal(%#v) = %#v, want %#v", input, got, want)
@@ -322,9 +312,7 @@ func TestJsonMarshalPositionPointer(t *testing.T) {
 	want := `"golf/par"`
 
 	buf, err := json.Marshal(&input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
 
 	if got := string(buf); got != want {
 		t.Errorf("json.Marshal(%#v) = %#v, want %#v", input, got, want)
@@ -340,12 +328,9 @@ func TestJsonUnmarshalPosition(t *testing.T) {
 
 	var got Position
 	err := json.Unmarshal([]byte(input), &got)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("json.Unmarshal(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "json.Unmarshal(%#v) = %#v, want %#v", input, got, want)
+
 }
 
 func TestJsonMarshalPositionInStruct(t *testing.T) {
@@ -357,9 +342,7 @@ func TestJsonMarshalPositionInStruct(t *testing.T) {
 	}
 
 	buf, err := json.Marshal(&mystruct{input})
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
 
 	if got := string(buf); got != want {
 		t.Errorf("json.Marshal(%#v) = %#v, want %#v", input, got, want)
@@ -377,9 +360,8 @@ func TestJsonUnmarshalPositionInStruct(t *testing.T) {
 		Position Position
 	}
 	err := json.Unmarshal([]byte(input), &gotStruct)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+
 	if got := gotStruct.Position; !got.Equal(want) {
 		t.Errorf("json.Unmarshal(%#v) = %#v, want %#v", input, got, want)
 	}
@@ -390,9 +372,7 @@ func TestJsonMarshalPositionZero(t *testing.T) {
 	want := `""`
 
 	buf, err := json.Marshal(input)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
 
 	if got := string(buf); got != want {
 		t.Errorf("json.Marshal(%#v) = %#v, want %#v", input, got, want)
@@ -405,10 +385,7 @@ func TestJsonUnmarshalPositionZero(t *testing.T) {
 
 	var got Position
 	err := json.Unmarshal([]byte(input), &got)
-	if err != nil {
-		t.Errorf("unexpected error: %v", err)
-	}
-	if !got.Equal(want) {
-		t.Errorf("json.Unmarshal(%#v) = %#v, want %#v", input, got, want)
-	}
+	assert.NoError(t, err, "unexpected error: %v", err)
+	assert.True(t, got.Equal(want), "json.Unmarshal(%#v) = %#v, want %#v", input, got, want)
+
 }
diff --git a/go/mysql/replication_test.go b/go/mysql/replication_test.go
index c801e89830..59c0353c00 100644
--- a/go/mysql/replication_test.go
+++ b/go/mysql/replication_test.go
@@ -19,6 +19,9 @@ package mysql
 import (
 	"reflect"
 	"testing"
+
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 func TestComBinlogDump(t *testing.T) {
@@ -35,9 +38,7 @@ func TestComBinlogDump(t *testing.T) {
 	}
 
 	data, err := sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - ComBinlogDump failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - ComBinlogDump failed: %v", err)
 
 	expectedData := []byte{
 		ComBinlogDump,
@@ -46,9 +47,8 @@ func TestComBinlogDump(t *testing.T) {
 		0x04, 0x03, 0x02, 0x01, // server-id
 		'm', 'o', 'o', 'f', 'a', 'r', 'm', // binlog-filename
 	}
-	if !reflect.DeepEqual(data, expectedData) {
-		t.Errorf("ComBinlogDump returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
-	}
+	assert.True(t, reflect.DeepEqual(data, expectedData), "ComBinlogDump returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
+
 	sConn.sequence = 0
 
 	// Write ComBinlogDump packet with no filename, read it, compare.
@@ -57,9 +57,7 @@ func TestComBinlogDump(t *testing.T) {
 	}
 
 	data, err = sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - ComBinlogDump failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - ComBinlogDump failed: %v", err)
 
 	expectedData = []byte{
 		ComBinlogDump,
@@ -67,9 +65,8 @@ func TestComBinlogDump(t *testing.T) {
 		0x0a, 0x09, // flags
 		0x04, 0x03, 0x02, 0x01, // server-id
 	}
-	if !reflect.DeepEqual(data, expectedData) {
-		t.Errorf("ComBinlogDump returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
-	}
+	assert.True(t, reflect.DeepEqual(data, expectedData), "ComBinlogDump returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
+
 }
 
 func TestComBinlogDumpGTID(t *testing.T) {
@@ -86,9 +83,7 @@ func TestComBinlogDumpGTID(t *testing.T) {
 	}
 
 	data, err := sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - ComBinlogDumpGTID failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - ComBinlogDumpGTID failed: %v", err)
 
 	expectedData := []byte{
 		ComBinlogDumpGTID,
@@ -100,9 +95,8 @@ func TestComBinlogDumpGTID(t *testing.T) {
 		0x02, 0x00, 0x00, 0x00, // data-size
 		0xfa, 0xfb, // data
 	}
-	if !reflect.DeepEqual(data, expectedData) {
-		t.Errorf("ComBinlogDumpGTID returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
-	}
+	assert.True(t, reflect.DeepEqual(data, expectedData), "ComBinlogDumpGTID returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
+
 	sConn.sequence = 0
 
 	// Write ComBinlogDumpGTID packet with no filename, read it, compare.
@@ -111,9 +105,7 @@ func TestComBinlogDumpGTID(t *testing.T) {
 	}
 
 	data, err = sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - ComBinlogDumpGTID failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - ComBinlogDumpGTID failed: %v", err)
 
 	expectedData = []byte{
 		ComBinlogDumpGTID,
@@ -124,9 +116,8 @@ func TestComBinlogDumpGTID(t *testing.T) {
 		0x02, 0x00, 0x00, 0x00, // data-size
 		0xfa, 0xfb, // data
 	}
-	if !reflect.DeepEqual(data, expectedData) {
-		t.Errorf("ComBinlogDumpGTID returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
-	}
+	assert.True(t, reflect.DeepEqual(data, expectedData), "ComBinlogDumpGTID returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
+
 }
 
 func TestSendSemiSyncAck(t *testing.T) {
@@ -145,16 +136,13 @@ func TestSendSemiSyncAck(t *testing.T) {
 	}
 
 	data, err := sConn.ReadPacket()
-	if err != nil {
-		t.Fatalf("sConn.ReadPacket - SendSemiSyncAck failed: %v", err)
-	}
+	require.NoError(t, err, "sConn.ReadPacket - SendSemiSyncAck failed: %v", err)
 
 	expectedData := []byte{
 		ComSemiSyncAck,
 		0x3c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // log pos
 		'm', 'o', 'o', 'f', 'a', 'r', 'm', // binlog-filename
 	}
-	if !reflect.DeepEqual(data, expectedData) {
-		t.Errorf("SendSemiSyncAck returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
-	}
+	assert.True(t, reflect.DeepEqual(data, expectedData), "SendSemiSyncAck returned unexpected data:\n%v\nwas expecting:\n%v", data, expectedData)
+
 }
diff --git a/go/mysql/server_flaky_test.go b/go/mysql/server_flaky_test.go
index ed30f6a9e7..d74e6d21f2 100644
--- a/go/mysql/server_flaky_test.go
+++ b/go/mysql/server_flaky_test.go
@@ -997,9 +997,7 @@ func TestCachingSha2PasswordAuthWithTLS(t *testing.T) {
 
 	// Create the listener, so we can get its host.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -1018,9 +1016,8 @@ func TestCachingSha2PasswordAuthWithTLS(t *testing.T) {
 		"",
 		"",
 		tls.VersionTLS12)
-	if err != nil {
-		t.Fatalf("TLSServerConfig failed: %v", err)
-	}
+	require.NoError(t, err, "TLSServerConfig failed: %v", err)
+
 	l.TLSConfig.Store(serverConfig)
 	go func() {
 		l.Accept()
@@ -1044,16 +1041,14 @@ func TestCachingSha2PasswordAuthWithTLS(t *testing.T) {
 	ctx := context.Background()
 
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("unexpected connection error: %v", err)
-	}
+	require.NoError(t, err, "unexpected connection error: %v", err)
+
 	defer conn.Close()
 
 	// Run a 'select rows' command with results.
 	result, err := conn.ExecuteFetch("select rows", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+
 	utils.MustMatch(t, result, selectRowsResult)
 
 	// Send a ComQuit to avoid the error message on the server side.
@@ -1096,9 +1091,7 @@ func TestCachingSha2PasswordAuthWithMoreData(t *testing.T) {
 
 	// Create the listener, so we can get its host.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
@@ -1117,9 +1110,8 @@ func TestCachingSha2PasswordAuthWithMoreData(t *testing.T) {
 		"",
 		"",
 		tls.VersionTLS12)
-	if err != nil {
-		t.Fatalf("TLSServerConfig failed: %v", err)
-	}
+	require.NoError(t, err, "TLSServerConfig failed: %v", err)
+
 	l.TLSConfig.Store(serverConfig)
 	go func() {
 		l.Accept()
@@ -1143,16 +1135,14 @@ func TestCachingSha2PasswordAuthWithMoreData(t *testing.T) {
 	ctx := context.Background()
 
 	conn, err := Connect(ctx, params)
-	if err != nil {
-		t.Fatalf("unexpected connection error: %v", err)
-	}
+	require.NoError(t, err, "unexpected connection error: %v", err)
+
 	defer conn.Close()
 
 	// Run a 'select rows' command with results.
 	result, err := conn.ExecuteFetch("select rows", 10000, true)
-	if err != nil {
-		t.Fatalf("ExecuteFetch failed: %v", err)
-	}
+	require.NoError(t, err, "ExecuteFetch failed: %v", err)
+
 	utils.MustMatch(t, result, selectRowsResult)
 
 	// Send a ComQuit to avoid the error message on the server side.
@@ -1170,9 +1160,7 @@ func TestCachingSha2PasswordAuthWithoutTLS(t *testing.T) {
 
 	// Create the listener.
 	l, err := NewListener("tcp", "127.0.0.1:", authServer, th, 0, 0, false, false)
-	if err != nil {
-		t.Fatalf("NewListener failed: %v", err)
-	}
+	require.NoError(t, err, "NewListener failed: %v", err)
 	defer l.Close()
 	host := l.Addr().(*net.TCPAddr).IP.String()
 	port := l.Addr().(*net.TCPAddr).Port
diff --git a/go/test/endtoend/utils/cmp.go b/go/test/endtoend/utils/cmp.go
index 89e51c1e66..a377ed777c 100644
--- a/go/test/endtoend/utils/cmp.go
+++ b/go/test/endtoend/utils/cmp.go
@@ -85,6 +85,39 @@ func (mcmp *MySQLCompare) AssertMatchesAny(query string, expected ...string) {
 	mcmp.t.Errorf("Query: %s (-want +got):\n%v\nGot:%s", query, expected, got)
 }
 
+// AssertMatchesAnyNoCompare ensures the given query produces any one of the expected results.
+// This method does not compare the mysql and vitess results together
+func (mcmp *MySQLCompare) AssertMatchesAnyNoCompare(query string, expected ...string) {
+	mcmp.t.Helper()
+
+	mQr, vQr := mcmp.execNoCompare(query)
+	got := fmt.Sprintf("%v", mQr.Rows)
+	valid := false
+	for _, e := range expected {
+		diff := cmp.Diff(e, got)
+		if diff == "" {
+			valid = true
+			break
+		}
+	}
+	if !valid {
+		mcmp.t.Errorf("MySQL Query: %s (-want +got):\n%v\nGot:%s", query, expected, got)
+	}
+	valid = false
+
+	got = fmt.Sprintf("%v", vQr.Rows)
+	for _, e := range expected {
+		diff := cmp.Diff(e, got)
+		if diff == "" {
+			valid = true
+			break
+		}
+	}
+	if !valid {
+		mcmp.t.Errorf("Vitess Query: %s (-want +got):\n%v\nGot:%s", query, expected, got)
+	}
+}
+
 // AssertContainsError executes the query on both Vitess and MySQL.
 // Both clients need to return an error. The error of Vitess must be matching the given expectation.
 func (mcmp *MySQLCompare) AssertContainsError(query, expected string) {
diff --git a/go/test/endtoend/vtgate/queries/derived/derived_test.go b/go/test/endtoend/vtgate/queries/derived/derived_test.go
index 5da8d8bac9..62601ed528 100644
--- a/go/test/endtoend/vtgate/queries/derived/derived_test.go
+++ b/go/test/endtoend/vtgate/queries/derived/derived_test.go
@@ -30,7 +30,7 @@ func start(t *testing.T) (utils.MySQLCompare, func()) {
 	require.NoError(t, err)
 
 	deleteAll := func() {
-		tables := []string{"music"}
+		tables := []string{"music", "user"}
 		for _, table := range tables {
 			_, _ = mcmp.ExecAndIgnore("delete from " + table)
 		}
@@ -56,6 +56,7 @@ func TestDerivedTableWithOrderByLimit(t *testing.T) {
 }
 
 func TestDerivedAggregationOnRHS(t *testing.T) {
+	t.Skip("skipped for now, issue: https://github.com/vitessio/vitess/issues/11703")
 	mcmp, closer := start(t)
 	defer closer()
 
@@ -84,10 +85,7 @@ func TestDerivedTableWithHaving(t *testing.T) {
 	mcmp.Exec("insert into user(id, name) values(1,'toto'), (2,'tata'), (3,'titi'), (4,'tete'), (5,'foo')")
 
 	mcmp.Exec("set sql_mode = ''")
-
-	// this is probably flaky? the id returned from the derived table could be any of the ids from user.
-	// works on my machine (TM)
-	mcmp.Exec("select  /*vt+ PLANNER=Gen4 */ * from (select id from user having count(*) >= 1) s")
+	mcmp.AssertMatchesAnyNoCompare("select  /*vt+ PLANNER=Gen4 */ * from (select id from user having count(*) >= 1) s", "[[INT64(1)]]", "[[INT64(4)]]")
 }
 
 func TestDerivedTableColumns(t *testing.T) {
diff --git a/go/vt/vtgate/planbuilder/plan_test.go b/go/vt/vtgate/planbuilder/plan_test.go
index 70f89f88ec..11a5bf6a6b 100644
--- a/go/vt/vtgate/planbuilder/plan_test.go
+++ b/go/vt/vtgate/planbuilder/plan_test.go
@@ -29,6 +29,7 @@ import (
 	"strings"
 	"testing"
 
+	"github.com/nsf/jsondiff"
 	"github.com/stretchr/testify/require"
 
 	vtgatepb "vitess.io/vitess/go/vt/proto/vtgate"
@@ -40,8 +41,6 @@ import (
 	"vitess.io/vitess/go/mysql/collations"
 	"vitess.io/vitess/go/vt/vtgate/semantics"
 
-	"github.com/google/go-cmp/cmp"
-
 	vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
 	"vitess.io/vitess/go/vt/vterrors"
 
@@ -716,19 +715,9 @@ type (
 	}
 )
 
-func compacted(in string) string {
-	if in != "" && in[0] != '{' {
-		return in
-	}
-	dst := bytes.NewBuffer(nil)
-	err := json.Compact(dst, []byte(in))
-	if err != nil {
-		panic(err)
-	}
-	return dst.String()
-}
-
 func testFile(t *testing.T, filename, tempDir string, vschema *vschemaWrapper, render bool) {
+	opts := jsondiff.DefaultConsoleOptions()
+
 	t.Run(filename, func(t *testing.T) {
 		var expected []planTest
 		var outFirstPlanner string
@@ -756,10 +745,9 @@ func testFile(t *testing.T, filename, tempDir string, vschema *vschemaWrapper, r
 				}
 				out := getPlanOrErrorOutput(err, plan)
 
-				lft := compacted(out)
-				rgt := compacted(string(tcase.V3Plan))
-				if lft != rgt {
-					t.Errorf("V3 - %s\nDiff:\n%s\n[%s] \n[%s]", filename, cmp.Diff(tcase.V3Plan, out), tcase.V3Plan, out)
+				compare, s := jsondiff.Compare(tcase.V3Plan, []byte(out), &opts)
+				if compare != jsondiff.FullMatch {
+					t.Errorf("V3 - %s\nDiff:\n%s\n[%s] \n[%s]", filename, s, tcase.V3Plan, out)
 				}
 
 				outFirstPlanner = out
@@ -781,11 +769,9 @@ func testFile(t *testing.T, filename, tempDir string, vschema *vschemaWrapper, r
 			//       with this last expectation, it is an error if the Gen4 planner
 			//       produces the same plan as the V3 planner does
 			t.Run(fmt.Sprintf("Gen4: %s", testName), func(t *testing.T) {
-				x := string(tcase.Gen4Plan)
-				s := compacted(out)
-				s2 := compacted(x)
-				if s != s2 {
-					t.Errorf("Gen4 - %s\nDiff:\n%s\n[%s] \n[%s]", filename, cmp.Diff(s, s2), tcase.Gen4Plan, out)
+				compare, s := jsondiff.Compare(tcase.Gen4Plan, []byte(out), &opts)
+				if compare != jsondiff.FullMatch {
+					t.Errorf("Gen4 - %s\nDiff:\n%s\n[%s] \n[%s]", filename, s, tcase.Gen4Plan, out)
 				}
 
 				if outFirstPlanner == out {
diff --git a/test/config.json b/test/config.json
index 7b0b8245f1..cb2dbf14c7 100644
--- a/test/config.json
+++ b/test/config.json
@@ -520,6 +520,15 @@
 			"RetryMax": 2,
 			"Tags": []
 		},
+		"vtgate_queries_derived": {
+			"File": "unused.go",
+			"Args": ["vitess.io/vitess/go/test/endtoend/vtgate/queries/derived"],
+			"Command": [],
+			"Manual": false,
+			"Shard": "vtgate_queries",
+			"RetryMax": 1,
+			"Tags": []
+		},
 		"vtgate_queries_aggregation": {
 			"File": "unused.go",
 			"Args": ["vitess.io/vitess/go/test/endtoend/vtgate/queries/aggregation"],
@@ -691,15 +700,6 @@
 			"RetryMax": 1,
 			"Tags": []
 		},
-		"vtgate_mysql80_derived": {
-			"File": "unused.go",
-			"Args": ["vitess.io/vitess/go/test/endtoend/vtgate/mysql80/derived"],
-			"Command": [],
-			"Manual": false,
-			"Shard": "mysql80",
-			"RetryMax": 1,
-			"Tags": []
-		},
 		"vtgate_sequence": {
 			"File": "unused.go",
 			"Args": ["vitess.io/vitess/go/test/endtoend/vtgate/sequence"],