Skip to content

tests: select testdb and use MySQL 8.0 by default #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
matrix:
go: [ "1.20", "1.19", "1.18" ]
os: [ ubuntu-22.04, ubuntu-20.04 ]
name: Tests Go ${{ matrix.go }} # This name is used in main branch protection rules
name: Tests Go ${{ matrix.go }} on ${{ matrix.os }} # This name is used in main branch protection rules
Copy link
Member

@atercattus atercattus May 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have "Protect matching branches" for the main branch which is based on full name like "Tests Go 1.18".
If we will use a 5 matrix.go with a 2 matrix.os we need to have 10 protection rules.

I suggest supporting only the last 2 or 3 versions of Go.

@lance6716 what do you think about this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I created this PR there were 4 Go versions. Now (since 1bd36e6) there are only 3 Go versions. So instead of 4x2=8 there are 3x2=6 matrix combinations.

https://endoflife.date/go shows that only 1.20 and 1.19 are supported upstream (the release policy is on https://go.dev/doc/devel/release)

runs-on: ${{ matrix.os }}

steps:
Expand All @@ -31,7 +31,7 @@ jobs:
run: |
sudo apt-get install -y make gcc
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ build:
test:
go test --race -timeout 2m ./...

MYSQL_VERSION ?= 5.7
MYSQL_VERSION ?= 8.0
test-local:
docker run --rm -d --network=host --name go-mysql-server \
-e MYSQL_ALLOW_EMPTY_PASSWORD=true \
Expand Down
3 changes: 3 additions & 0 deletions client/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ func (s *connTestSuite) TestExecuteMultiple() {
`THIS IS BOGUS()`,
}

_, err := s.c.Execute("USE " + *testDB)
require.Nil(s.T(), err)

count := 0
result, err := s.c.ExecuteMultiple(strings.Join(queries, "; "), func(result *mysql.Result, err error) {
switch count {
Expand Down
2 changes: 1 addition & 1 deletion docker/resources/waitfor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ port=$2

echo "Waiting for mysql at $host:$port"
while true; do
docker run --rm -it --network=host mysql:5.7 mysql -h$host -P$port -e "SELECT RAND()" >/dev/null
docker run --rm -it --network=host mysql:8.0 mysql -h$host -P$port -e "SELECT RAND()" >/dev/null
if [[ $? -eq 0 ]]; then
echo 'Connected'
break
Expand Down