Skip to content

Commit 11e0f8c

Browse files
authored
chore: Updated mysql tests to use MySQL 8.3 (#2280)
1 parent e036436 commit 11e0f8c

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

docker-compose.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,15 @@ services:
8585

8686
mysql:
8787
container_name: nr_node_mysql
88-
# The `mysql:5` image does not have a `linux/arm64` build.
89-
# We cannot use the latest mysql image because our tests fail.
90-
platform: linux/amd64
91-
image: mysql:5
88+
platform: ${DOCKER_PLATFORM:-linux/amd64}
89+
# We cannot use an image later than 8.3 because they have fully removed
90+
# the configuration option we need in order to switch back to the native
91+
# authentication method. We must use the native authentication method
92+
# because the `mysql` package does not support the `caching_sha2_password`
93+
# authentication method.
94+
image: mysql:8.3
95+
volumes:
96+
- "./docker/mysql:/etc/mysql/conf.d"
9297
ports:
9398
- "3306:3306"
9499
environment:

docker/Readme.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This directory contains resources for Docker containers that are used in
2+
our versioned tests. A typical case would be to mount a directory as a volume.
3+
For example:
4+
5+
```yaml
6+
mysql:
7+
container_name: nr_node_mysql
8+
platform: ${DOCKER_PLATFORM:-linux/amd64}
9+
image: mysql:8.3
10+
volumes:
11+
- "./docker/mysql:/etc/mysql/conf.d"
12+
ports:
13+
- "3306:3306"
14+
environment:
15+
MYSQL_ALLOW_EMPTY_PASSWORD: 1
16+
healthcheck:
17+
test: ["CMD", "mysql" ,"-h", "mysql", "-P", "3306", "-u", "root", "-e", "SELECT 1"]
18+
interval: 1s
19+
timeout: 10s
20+
retries: 30
21+
```

docker/mysql/my.cnf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[mysqld]
2+
# Without changing the verbosity to 1, we will get a warning about the
3+
# authentication method deprecation _every second_.
4+
log_error_verbosity=1
5+
6+
# Switch us back to the pre-8.0 authentication method.
7+
default-authentication-plugin=mysql_native_password

test/versioned/mysql/helpers.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ async function createDb(mysql, user, db) {
3838
await runCommand(client, `CREATE USER ${user}`)
3939
await runCommand(client, `GRANT ALL ON *.* TO ${user}`)
4040
await runCommand(client, `CREATE DATABASE IF NOT EXISTS ${db}`)
41+
await runCommand(client, `FLUSH PRIVILEGES`)
42+
await runCommand(client, `FLUSH TABLES`)
4143
client.end()
4244
}
4345

@@ -52,7 +54,8 @@ async function createTable(mysql, user, db, table) {
5254
await runCommand(
5355
client,
5456
[
55-
`CREATE TABLE IF NOT EXISTS ${table} (`,
57+
`CREATE TABLE IF NOT EXISTS ${table}
58+
(`,
5659
' `id` INTEGER(10) PRIMARY KEY AUTO_INCREMENT,',
5760
' `test_value` VARCHAR(255)',
5861
')'

0 commit comments

Comments
 (0)