From 73952d0e03f9134df43969ad4b168c72f4d622af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Wed, 6 Jul 2022 14:31:19 -0300 Subject: [PATCH 1/3] Update kmysql_test.go to use mariadb instead of mysql This change was made because the mysql image was too instable which caused it to fail in several situations. --- .github/workflows/ci.yml | 4 ++-- adapters/kmysql/kmysql_test.go | 10 +++++----- scripts/run-all-tests.sh | 4 +--- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 033cef8..cd39fc8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,8 +9,8 @@ jobs: - uses: actions/checkout@v2 - name: Pull Postgres run: docker pull postgres:14.0 - - name: Pull MySQL - run: docker pull mysql:8.0.27 + - name: Pull MariaDB + run: docker pull mariadb:10.8 - name: Pull SQLServer run: docker pull mcr.microsoft.com/mssql/server:2017-latest - name: Check go version diff --git a/adapters/kmysql/kmysql_test.go b/adapters/kmysql/kmysql_test.go index db29c30..b8d19bb 100644 --- a/adapters/kmysql/kmysql_test.go +++ b/adapters/kmysql/kmysql_test.go @@ -36,11 +36,11 @@ func startMySQLDB(dbName string) (databaseURL string, closer func()) { // pulls an image, creates a container based on it and runs it resource, err := pool.RunWithOptions( &dockertest.RunOptions{ - Repository: "mysql", - Tag: "8.0.27", + Repository: "mariadb", + Tag: "10.8", Env: []string{ - "MYSQL_ROOT_PASSWORD=mysql", - "MYSQL_DATABASE=" + dbName, + "MARIADB_ROOT_PASSWORD=mysql", + "MARIADB_DATABASE=" + dbName, }, }, func(config *docker.HostConfig) { @@ -56,7 +56,7 @@ func startMySQLDB(dbName string) (databaseURL string, closer func()) { hostAndPort := resource.GetHostPort("3306/tcp") databaseUrl := fmt.Sprintf("root:mysql@(%s)/%s?timeout=30s", hostAndPort, dbName) - fmt.Println("Connecting to mysql on url: ", databaseUrl) + fmt.Println("Connecting to mariadb on url: ", databaseUrl) resource.Expire(40) // Tell docker to hard kill the container in 40 seconds diff --git a/scripts/run-all-tests.sh b/scripts/run-all-tests.sh index 31a5875..d5fbd15 100755 --- a/scripts/run-all-tests.sh +++ b/scripts/run-all-tests.sh @@ -21,8 +21,6 @@ export PATH=$PATH:$(pwd)/scripts ( cd adapters/kpgx ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... ) ( cd adapters/ksqlite3 ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... ) ( cd adapters/ksqlserver ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... ) - -# Disabled this one because the mysql container fails to start too often on the CI: -#( cd adapters/kmysql ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... ) +( cd adapters/kmysql ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... ) # codecov will find all `coverate.txt` files, so it will work fine. From 3577f0674c1e37faf316b0f73aa00bea335fa792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Wed, 6 Jul 2022 20:09:50 -0300 Subject: [PATCH 2/3] Update Makefile to use go install instead of the old go get --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f265caa..e97559a 100644 --- a/Makefile +++ b/Makefile @@ -36,15 +36,14 @@ mock: setup setup: $(GOBIN)/richgo $(GOBIN)/staticcheck $(GOBIN)/mockgen $(GOBIN)/richgo: - go get github.com/kyoh86/richgo + go install github.com/kyoh86/richgo@latest $(GOBIN)/staticcheck: go install honnef.co/go/tools/cmd/staticcheck@latest $(GOBIN)/mockgen: @# (Gomock is used on examples/example_service) - go get github.com/golang/mock/gomock - go get github.com/golang/mock/mockgen + go install github.com/golang/mock/mockgen@latest # Running examples: exampleservice: mock From 891aa8c7b163d5ee8957ee2b4a90369dd179f7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Garcia?= Date: Wed, 6 Jul 2022 20:21:23 -0300 Subject: [PATCH 3/3] Fix find command to work on mac and linux --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e97559a..58a6675 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ lint: setup go-mod-tidy # Run go mod tidy for all submodules: go-mod-tidy: - @find -name go.mod -execdir go mod tidy \; + find . -name go.mod -execdir go mod tidy \; gen: mock mock: setup