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

Conversation

dveeden
Copy link
Collaborator

@dveeden dveeden commented May 7, 2023

  • Without the USE... in TestExecuteMultiple the test panics as the result in conn_test.go:108 is nil. This doesn't seem to happen consistently. Seems to happen with both 5.7 and 8.0.
  • Use MySQL 8.0 instead of MySQL 5.7
  • Add Go 1.20
  • Upgrade actions/setup-go
  • Include OS name in the name of the test
$ go test

----------------------------------------------------------------------
PANIC: conn_test.go:92: connTestSuite.TestExecuteMultiple

... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0x438592)

/usr/lib/golang/src/runtime/panic.go:884
  in gopanic
/usr/lib/golang/src/runtime/panic.go:260
  in panicmem
/usr/lib/golang/src/runtime/signal_unix.go:837
  in sigpanic
conn_test.go:108
  in connTestSuite.TestExecuteMultiple.func1
conn.go:273
  in Conn.ExecuteMultiple
conn_test.go:101
  in connTestSuite.TestExecuteMultiple
/usr/lib/golang/src/reflect/value.go:370
  in Value.Call
/home/dvaneeden/go/pkg/mod/github.com/pingcap/[email protected]/check.go:836
  in suiteRunner.forkTest.func1
/home/dvaneeden/go/pkg/mod/github.com/pingcap/[email protected]/check.go:730
  in suiteRunner.forkCall.func1
/usr/lib/golang/src/runtime/asm_amd64.s:1598
  in goexit

----------------------------------------------------------------------
FAIL: conn_test.go:132: connTestSuite.TestExecuteSelectStreaming

conn_test.go:170:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

----------------------------------------------------------------------
FAIL: conn_test.go:86: connTestSuite.TestFieldList

conn_test.go:88:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

----------------------------------------------------------------------
FAIL: conn_test.go:38: connTestSuite.TearDownSuite

conn_test.go:43:
    s.testExecute_DropTable(c)
conn_test.go:83:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

OOPS: 18 passed, 3 FAILED, 1 PANICKED
--- FAIL: Test (0.46s)
FAIL
exit status 1
FAIL	github.com/go-mysql-org/go-mysql/client	0.465s

Without the `USE...` in `TestExecuteMultiple` the test panics as the
result in `conn_test.go:108` is nil.

```
$ go test

----------------------------------------------------------------------
PANIC: conn_test.go:92: connTestSuite.TestExecuteMultiple

... Panic: runtime error: invalid memory address or nil pointer dereference (PC=0x438592)

/usr/lib/golang/src/runtime/panic.go:884
  in gopanic
/usr/lib/golang/src/runtime/panic.go:260
  in panicmem
/usr/lib/golang/src/runtime/signal_unix.go:837
  in sigpanic
conn_test.go:108
  in connTestSuite.TestExecuteMultiple.func1
conn.go:273
  in Conn.ExecuteMultiple
conn_test.go:101
  in connTestSuite.TestExecuteMultiple
/usr/lib/golang/src/reflect/value.go:370
  in Value.Call
/home/dvaneeden/go/pkg/mod/github.com/pingcap/[email protected]/check.go:836
  in suiteRunner.forkTest.func1
/home/dvaneeden/go/pkg/mod/github.com/pingcap/[email protected]/check.go:730
  in suiteRunner.forkCall.func1
/usr/lib/golang/src/runtime/asm_amd64.s:1598
  in goexit

----------------------------------------------------------------------
FAIL: conn_test.go:132: connTestSuite.TestExecuteSelectStreaming

conn_test.go:170:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

----------------------------------------------------------------------
FAIL: conn_test.go:86: connTestSuite.TestFieldList

conn_test.go:88:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

----------------------------------------------------------------------
FAIL: conn_test.go:38: connTestSuite.TearDownSuite

conn_test.go:43:
    s.testExecute_DropTable(c)
conn_test.go:83:
    c.Assert(err, IsNil)
... value *mysql.MyError = &mysql.MyError{Code:0x416, Message:"No database selected", State:"3D000"} ("ERROR 1046 (3D000): No database selected")

OOPS: 18 passed, 3 FAILED, 1 PANICKED
--- FAIL: Test (0.46s)
FAIL
exit status 1
FAIL	github.com/go-mysql-org/go-mysql/client	0.465s
```
@dveeden dveeden closed this May 7, 2023
@dveeden dveeden reopened this May 7, 2023
@dveeden dveeden closed this May 7, 2023
@dveeden dveeden reopened this May 7, 2023
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)

@lance6716
Copy link
Collaborator

@dveeden Hi, would you mind I resolve git conflicts directly in your PR?

@dveeden
Copy link
Collaborator Author

dveeden commented Jun 30, 2023

@dveeden Hi, would you mind I resolve git conflicts directly in your PR?

Done

@lance6716
Copy link
Collaborator

Thanks! we now keep golang, OS of testing image and MySQL all up-to-date

@lance6716 lance6716 merged commit dc97dfa into go-mysql-org:master Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants