Skip to content
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

chore: Updated mysql tests to use MySQL 8.3 #2280

Merged
merged 1 commit into from
Jun 17, 2024
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
13 changes: 9 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,15 @@ services:

mysql:
container_name: nr_node_mysql
# The `mysql:5` image does not have a `linux/arm64` build.
# We cannot use the latest mysql image because our tests fail.
platform: linux/amd64
image: mysql:5
platform: ${DOCKER_PLATFORM:-linux/amd64}
# We cannot use an image later than 8.3 because they have fully removed
# the configuration option we need in order to switch back to the native
# authentication method. We must use the native authentication method
# because the `mysql` package does not support the `caching_sha2_password`
# authentication method.
image: mysql:8.3
volumes:
- "./docker/mysql:/etc/mysql/conf.d"
ports:
- "3306:3306"
environment:
Expand Down
21 changes: 21 additions & 0 deletions docker/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
This directory contains resources for Docker containers that are used in
our versioned tests. A typical case would be to mount a directory as a volume.
For example:

```yaml
mysql:
container_name: nr_node_mysql
platform: ${DOCKER_PLATFORM:-linux/amd64}
image: mysql:8.3
volumes:
- "./docker/mysql:/etc/mysql/conf.d"
ports:
- "3306:3306"
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
healthcheck:
test: ["CMD", "mysql" ,"-h", "mysql", "-P", "3306", "-u", "root", "-e", "SELECT 1"]
interval: 1s
timeout: 10s
retries: 30
```
7 changes: 7 additions & 0 deletions docker/mysql/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[mysqld]
# Without changing the verbosity to 1, we will get a warning about the
# authentication method deprecation _every second_.
log_error_verbosity=1

# Switch us back to the pre-8.0 authentication method.
default-authentication-plugin=mysql_native_password
5 changes: 4 additions & 1 deletion test/versioned/mysql/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function createDb(mysql, user, db) {
await runCommand(client, `CREATE USER ${user}`)
await runCommand(client, `GRANT ALL ON *.* TO ${user}`)
await runCommand(client, `CREATE DATABASE IF NOT EXISTS ${db}`)
await runCommand(client, `FLUSH PRIVILEGES`)
await runCommand(client, `FLUSH TABLES`)
Comment on lines +41 to +42
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we really need these, but they certainly don't hurt.

client.end()
}

Expand All @@ -52,7 +54,8 @@ async function createTable(mysql, user, db, table) {
await runCommand(
client,
[
`CREATE TABLE IF NOT EXISTS ${table} (`,
`CREATE TABLE IF NOT EXISTS ${table}
(`,
' `id` INTEGER(10) PRIMARY KEY AUTO_INCREMENT,',
' `test_value` VARCHAR(255)',
')'
Expand Down
Loading