Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

Add `-tags=mysql` to run all tests (#1322)

p0nyf60ec446ee4d
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 1cbff433b0..2302d524e4 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -41,8 +41,17 @@ jobs:
- uses: actions/setup-go@v2
with:
go-version: 1.17
- - run: |
- go test -v ./...
+ - name: Cache MySQL
+ uses: actions/cache@v3
+ with:
+ path: |
+ ./resources/mysql/*.tar.gz
+ ./resources/mysql/*.tar.xz
+ key: ${{ runner.OS }}-build-mysql-cache
+ - name: Install dependencies and run all tests
+ run: |
+ go generate -tags mysql ./...
+ go test -v ./... -tags=mysql
# tests if scripts/install_bb.sh is working correctly.
install-bb:
diff --git a/resources/mysql/mysql.go b/resources/mysql/mysql.go
index 5a94894baf..47dce364e9 100644
--- a/resources/mysql/mysql.go
+++ b/resources/mysql/mysql.go
@@ -53,7 +53,7 @@ func (i *Instance) Start(port int, stdout, stderr io.Writer) (err error) {
i.proc = cmd.Process
// wait for mysql to start
- db, err := sql.Open("mysql", fmt.Sprintf("root@tcp(localhost:%d)/mysql", i.port))
+ db, err := sql.Open("mysql", fmt.Sprintf("root@tcp(127.0.0.1:%d)/mysql", i.port))
if err != nil {
return err
}
@@ -116,6 +116,7 @@ func Install(basedir, datadir, user string) (*Instance, error) {
basedir=%s
datadir=%s
socket=mysql.sock
+mysqlx=0
user=%s
`
defaultCfgFile, err := os.Create(filepath.Join(basedir, "my.cnf"))
@@ -175,7 +176,7 @@ func (i *Instance) Import(path string, stdout, stderr io.Writer) error {
return err
}
- db, err := sql.Open("mysql", fmt.Sprintf("root@tcp(localhost:%d)/?multiStatements=true", i.port))
+ db, err := sql.Open("mysql", fmt.Sprintf("root@tcp(127.0.0.1:%d)/?multiStatements=true", i.port))
if err != nil {
return err
}
diff --git a/tests/ghost_test.go b/tests/ghost_test.go
index fc0332dee6..906d77a531 100644
--- a/tests/ghost_test.go
+++ b/tests/ghost_test.go
@@ -56,7 +56,7 @@ func TestGhostSchemaUpdate(t *testing.T) {
_, stopInstance := mysql.SetupTestInstance(t, port)
defer stopInstance()
- mysqlDB, err := sql.Open("mysql", fmt.Sprintf("root@tcp(localhost:%d)/mysql", port))
+ mysqlDB, err := sql.Open("mysql", fmt.Sprintf("root@tcp(127.0.0.1:%d)/mysql", port))
a.NoError(err)
defer mysqlDB.Close()