Skip to content

Commit ab2554a

Browse files
remove databaseDirectoryPath internal option
1 parent fe35930 commit ab2554a

File tree

5 files changed

+11
-4
lines changed

5 files changed

+11
-4
lines changed

.github/workflows/os-compatibility.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- name: Run tests
3434
env:
3535
VERSION_REQUIREMENT: ${{ matrix.version-requirement }}
36+
MOVE_MYSQLMSN_TO: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }}
3637
run: npm run os-compat:ci
3738

3839
- name: Upload mysqlmsn directory (Windows)

dist/src/constants.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ export declare const LOG_LEVELS: {
88
};
99
declare const internalOptions: {
1010
deleteDBAfterStopped: string;
11-
databaseDirectoryPath: string;
1211
binaryDirectoryPath: string;
1312
cli: string;
1413
};

src/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const LOG_LEVELS = {
3232
const internalOptions = {
3333
deleteDBAfterStopped: 'true',
3434
//mysqlmsn = MySQL Memory Server Node.js
35-
databaseDirectoryPath: normalizePath(`${tmpdir()}/mysqlmsn/dbs`),
3635
binaryDirectoryPath: `${tmpdir()}/mysqlmsn/binaries`,
3736
cli: 'false'
3837
}

src/libraries/Executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ class Executor {
516516

517517
let retries = 0;
518518

519-
this.databasePath = normalizePath(`${getInternalEnvVariable('databaseDirectoryPath')}/${randomUUID().replaceAll("-", '')}`)
519+
this.databasePath = normalizePath(`${os.tmpdir()}/mysqlmsn/dbs/${randomUUID().replaceAll("-", '')}`)
520520

521521
const datadir = normalizePath(`${this.databasePath}/data`)
522522

tests/versions.test.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import {expect, test, jest} from '@jest/globals'
1+
import {expect, test, jest, afterAll} from '@jest/globals'
22
import { createDB } from '../src/index'
33
import sql from 'mysql2/promise'
44
import { coerce, satisfies } from 'semver';
55
import { ServerOptions } from '../types';
66
import getBinaryURL from '../src/libraries/Version';
77
import { DOWNLOADABLE_MYSQL_VERSIONS } from '../src/constants';
8+
import fsPromises from 'fs/promises'
9+
import os from 'os'
810

911
const usernames = ['root', 'dbuser']
1012

@@ -56,4 +58,10 @@ for (const version of DOWNLOADABLE_MYSQL_VERSIONS.filter(v => satisfies(v, proce
5658
//binary, we need this test here just in case all the MySQL binaries are skipped
5759
test('dummy test', () => {
5860
expect(1 + 1).toBe(2)
61+
})
62+
63+
afterAll(async () => {
64+
if (process.env.MOVE_MYSQLMSN_TO) {
65+
await fsPromises.rename(`${os.tmpdir()}/mysqlmsn`, process.env.MOVE_MYSQLMSN_TO)
66+
}
5967
})

0 commit comments

Comments
 (0)