The IntegrationTests project is intended to verify that MySqlConnector performs as expected with various MySQL-compatible servers.
It also verifies that MySqlConnector and MySQL Connector/NET (MySql.Data) have similar behavior, except where MySqlConnector fixes known bugs or makes other non-backwards-compatible changes.
The tests require a MySQL server. The simplest way to run one is with Docker:
docker run -d --rm --pull always --name mysqlconnector -e MYSQL_ROOT_PASSWORD=pass -p 3306:3306 --tmpfs /var/lib/mysql mysql:9.7 --max-allowed-packet=96M --character-set-server=utf8mb4 --disable-log-bin --local-infile=1 --max-connections=250
docker exec mysqlconnector mysql -uroot -ppass -e "INSTALL COMPONENT 'file://component_query_attributes'; CREATE USER 'caching-sha2-user'@'%' IDENTIFIED WITH caching_sha2_password BY 'Cach!ng-Sh@2-Pa55'; GRANT ALL PRIVILEGES ON *.* TO 'caching-sha2-user'@'%';"
Copy the file IntegrationTests/config.json.example to IntegrationTests/config.json, then edit
the config.json file in order to connect to your server. If you are using the Docker
command above, then the default options will work and do not need to be modified.
Otherwise, set the following options appropriately:
Data.ConnectionString: The full connection string to your server. You should specify a database name. If the database does not exist, the test will attempt to create it.Data.PasswordlessUser: (Optional) A user account in your database with no password and no roles.Data.SecondaryDatabase: (Optional) A second database on your server that the test user has permission to access.Data.CertificatesPath: (Optional) The absolute path to the server and client certificates folder (i.e., the.ci/server/certsfolder in this repo).Data.MySqlBulkLoaderLocalCsvFile: (Optional) The path to a test CSV file.Data.MySqlBulkLoaderLocalTsvFile: (Optional) The path to a test TSV file.Data.UnsupportedFeatures: A comma-delimited list ofServerFeatureenum values that your test database server does not supportCachingSha2Password: a user namedcaching-sha2-userexists on your server and uses thecaching_sha2_passwordauth pluginEd25519: a user nameded25519userexists on your server and uses theclient_ed25519auth pluginJson: theJSONdata type (MySQL 5.7 and later)LargePackets: large packets (over 4MB)Redirection: server supports sending redirection information in a server variable in the first OK packetRoundDateTime: server roundsdatetimevalues to the specified precision (not implemented in MariaDB)RsaEncryption: server supports RSA public key encryption (forsha256_passwordandcaching_sha2_password)SessionTrack: server supportsCLIENT_SESSION_TRACKcapability (MySQL 5.7 and later)Sha256Password: a user namedsha256userexists on your server and uses thesha256_passwordauth pluginStoredProcedures: create and execute stored proceduresTimeout: server can cancel queries promptly (so timed tests don't time out)Tls11: server supports TLS 1.1Tls12: server supports TLS 1.2Tls13: server supports TLS 1.3TlsFingerprintValidation: server provides a hash of the TLS certificate fingerprint in the first OK packetUnixDomainSocket: server is accessible via a Unix domain socketUuidToBin: server supportsUUID_TO_BIN(MySQL 8.0 and later)CancelSleepSuccessfully: ASLEEPcommand produces a result set when it is cancelled, not an error payload.GlobalLog: Server supportsset global general_log.KnownCertificateAuthority: The certificates used by the database server are trusted by the client.ParsecAuthentication: Server supports the 'parsec' authentication plugin.QueryAttributes: Server supports query attributes (MySQL 8.4 and later).ResetConnection: Server supports theCOM_RESET_CONNECTIONcommand.StreamingResults: The MySQL server can start streaming rows back as soon as they are available, as opposed to buffering the entire result set in memory.Vector: Server supports theVECTORSQL type.VectorType: Server has a dedicated type on the wire forVECTOR.ZeroDateTime: Server allows0000-00-00to be stored asDATEorDATETIME; i.e., it does not have theNO_ZERO_DATESQL mode or strict mode enabled.
There are two ways to run the tests: command line and Visual Studio.
After building the solution, you should see a list of tests in the Test Explorer. Click "Run All" to run them.
To run the tests against MySqlConnector:
cd tests\IntegrationTests
dotnet test -c Release
To run the tests against MySql.Data:
cd tests\IntegrationTests
dotnet restore /p:Configuration=MySqlData && dotnet test -c MySqlData