Description
I would like to contribute integration tests that test the behavior of the driver against various connectivity corner cases. To start with, these are:
- client sends query, but server kills connection before response received
- server kills connection while client is idle, client tries to reuse connection.
These will be done inside a Go binary that launches a throwaway instance of mysqld, interacts with it using the driver and ensures that certain error responses are returned.
To avoid checking any MySQL binaries into the repo, the binary will take some arguments (eg. --mysqld=/usr/bin/mysqld
) which will be used to locate the binary launched. This means it will not automatically run as a unit test, but it should still be straightforward to run when making changes.
My intention is that we can steadily grow this test and use it to objectively demonstrate or refute connectivity issues -- pull requests to fix an edge case could be required to add a testcase to this file along with the change, avoiding back-and-forth over issues.
They can also be used as living documentation of the driver's behavior under specific conditions.
Please let me know if you have any concerns -- I plan to start working on this shortly.