Merge branch 'dev' into feat/lam-1291/stress-testing
* dev: (85 commits) chore: console.log debug leftovers fix: third level navigation links fix: show subheader on refresh fix: machines/:id routing fix: customer route chore: update wallet nodes feat: shorten long addresses in funding page feat: shorten long addresses refactor: support copied text different from presented text chore: udpate react, downshift and routing refactor: use Wizard component on first route fix: autocomplete component rendering feat: skip2fa option on .env fix: drop contraint before dropping index chore: stop using alias imports fix: re-instate urlResolver chore: server code formatting chore: reformat code chore: adding eslint and prettier config chore: typo ...
This commit is contained in:
commit
e10493abc6
1398 changed files with 60329 additions and 157527 deletions
56
packages/server/tests/stress/server.js
Normal file
56
packages/server/tests/stress/server.js
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
const { fork } = require('node:child_process')
|
||||
const { join } = require('node:path')
|
||||
|
||||
const { EXIT } = require('./consts')
|
||||
const CLI = require('./cli')
|
||||
|
||||
const help_message = 'Start the server configured for stress testing.'
|
||||
|
||||
const cli = CLI({
|
||||
grammar: [[['--help'], 'Show this help message']],
|
||||
})
|
||||
|
||||
const help = exit_code => {
|
||||
console.log('Usage: lamassu-server-stress-testing server ARGS...')
|
||||
console.log(help_message)
|
||||
cli.help()
|
||||
return exit_code
|
||||
}
|
||||
|
||||
const start_server = args =>
|
||||
new Promise(resolve => {
|
||||
const lamassu_server = join(__dirname, '../../bin/lamassu-server')
|
||||
const ls = fork(lamassu_server, args, {
|
||||
cwd: process.cwd(),
|
||||
encoding: 'utf8',
|
||||
env: { LAMASSU_STRESS_TESTING: 'YES' },
|
||||
})
|
||||
|
||||
ls.on('error', error => {
|
||||
console.log(error)
|
||||
resolve(EXIT.EXCEPTION)
|
||||
})
|
||||
|
||||
ls.on('exit', (code, signal) => {
|
||||
console.error('lamassu-server code:', code)
|
||||
console.error('lamassu-server signal:', signal)
|
||||
resolve(typeof code === 'number' ? code : EXIT.EXCEPTION)
|
||||
})
|
||||
})
|
||||
|
||||
const run = async args => {
|
||||
const [err, options, positional] = cli.parse(args)
|
||||
if (err) {
|
||||
console.error(err)
|
||||
return help(EXIT.BADARGS)
|
||||
}
|
||||
|
||||
if (options.help) return help(EXIT.OK)
|
||||
|
||||
return await start_server(positional)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
help_message,
|
||||
run,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue