Skip to content

Commit a8d88be

Browse files
delete the database if the run was successful
1 parent 84036f7 commit a8d88be

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

.github/workflows/os-compatibility.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,6 @@ jobs:
8181
container: fedora:${{ matrix.version }}
8282

8383
steps:
84-
- name: Free Disk Space
85-
uses: jlumbroso/free-disk-space@main
86-
with:
87-
tool-cache: true
88-
android: true
89-
dotnet: true
90-
haskell: true
91-
large-packages: true
92-
docker-images: true
93-
swap-storage: true
94-
9584
- name: Checkout
9685
uses: actions/checkout@v4
9786

tests/versions.test.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ServerOptions } from '../types';
77
import { normalize } from 'path';
88
import getBinaryURL from '../src/libraries/Version';
99
import { DOWNLOADABLE_MYSQL_VERSIONS } from '../src/constants';
10+
import fsPromises from 'fs/promises'
1011

1112
const usernames = ['root', 'dbuser']
1213

@@ -38,9 +39,11 @@ for (const version of DOWNLOADABLE_MYSQL_VERSIONS) {
3839
initSQLString: 'CREATE DATABASE mytestdb;',
3940
arch
4041
}
42+
43+
const CIDBPath = `${dbPath}/${randomUUID()}`
4144

4245
if (process.env.useCIDBPath) {
43-
process.env.mysqlmsn_internal_DO_NOT_USE_dbPath = `${dbPath}/${randomUUID()}`
46+
process.env.mysqlmsn_internal_DO_NOT_USE_dbPath = CIDBPath
4447
process.env.mysqlmsn_internal_DO_NOT_USE_binaryDirectoryPath = binaryPath
4548
}
4649

@@ -58,6 +61,15 @@ for (const version of DOWNLOADABLE_MYSQL_VERSIONS) {
5861

5962
await connection.end();
6063
await db.stop();
64+
65+
//If everything was successful, delete the database if running in CI (if not running in CI, deleteDBAfterStopped is set to true and so the db is deleted automatically)
66+
try {
67+
if (process.env.useCIDBPath) {
68+
await fsPromises.rm(CIDBPath, {recursive: true, force: true, retryDelay: 100, maxRetries: 50})
69+
}
70+
} catch (e) {
71+
console.error('An error occurred while deleting successful database with version:', version, 'and username:', username, '. The error was:', e)
72+
}
6173

6274
expect(satisfies(coerce(mySQLVersion) || 'error', version)).toBe(true)
6375
})

0 commit comments

Comments
 (0)