mirror of
https://codeberg.org/timelimit/timelimit-server.git
synced 2026-08-31 19:03:45 +02:00
Adjust test scripts for current database versions
This commit is contained in:
@@ -24,6 +24,8 @@ const { spawnAsync } = require('../process.js')
|
|||||||
const { sleep } = require('../sleep.js')
|
const { sleep } = require('../sleep.js')
|
||||||
|
|
||||||
async function startMariadb() {
|
async function startMariadb() {
|
||||||
|
const osUsername = require('os').userInfo().username
|
||||||
|
|
||||||
try { await mkdirAsync(tempDir) } catch (ex) {/* ignore */}
|
try { await mkdirAsync(tempDir) } catch (ex) {/* ignore */}
|
||||||
|
|
||||||
const instanceDir = resolve(tempDir, generateShortToken())
|
const instanceDir = resolve(tempDir, generateShortToken())
|
||||||
@@ -60,12 +62,12 @@ async function startMariadb() {
|
|||||||
|
|
||||||
for (command of commands) {
|
for (command of commands) {
|
||||||
console.log(command)
|
console.log(command)
|
||||||
await spawnAsync('mysql', ['-S', socketPath, '-u', 'root', '-e', command], { stdio: 'inherit' })
|
await spawnAsync('mysql', ['-S', socketPath, '-u', osUsername, '-e', command], { stdio: 'inherit' })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
shutdown: () => {
|
shutdown: () => {
|
||||||
spawnAsync('mysql', ['-S', socketPath, '-u', 'root', '-e', 'SHUTDOWN;'], { stdio: 'inherit' }).catch((ex) => {
|
spawnAsync('mysql', ['-S', socketPath, '-u', osUsername, '-e', 'SHUTDOWN;'], { stdio: 'inherit' }).catch((ex) => {
|
||||||
console.warn(ex)
|
console.warn(ex)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ async function startPostgres() {
|
|||||||
const password = generateToken() // this database accepts anything
|
const password = generateToken() // this database accepts anything
|
||||||
|
|
||||||
await spawnAsync('createuser', ['-h', socketDir, username], { stdio: 'inherit' })
|
await spawnAsync('createuser', ['-h', socketDir, username], { stdio: 'inherit' })
|
||||||
await spawnAsync('createdb', ['-h', socketDir, database], { stdio: 'inherit' })
|
await spawnAsync('createdb', ['-h', socketDir, '--owner', username, database], { stdio: 'inherit' })
|
||||||
|
|
||||||
return {
|
return {
|
||||||
shutdown: () => task.kill('SIGINT'),
|
shutdown: () => task.kill('SIGINT'),
|
||||||
|
|||||||
Reference in New Issue
Block a user