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
79
packages/server/tests/stress/index.js
Normal file
79
packages/server/tests/stress/index.js
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
const { EXIT } = require('./consts')
|
||||
|
||||
const SUBCMDS = {
|
||||
env: require('./env'),
|
||||
db: require('./db'),
|
||||
machines: require('./machines'),
|
||||
server: require('./server'),
|
||||
}
|
||||
|
||||
const README = `
|
||||
This program will help you set the lamassu-server up for stress testing. This
|
||||
short introduction is meant only as a quickstart guide; the subcommands may
|
||||
support more options beyond those shown here. Use the --help flag for details
|
||||
on each subcommand.
|
||||
|
||||
First of all, you need to create a suitable .env file. With the following
|
||||
commands, .env.bak will be used as a starting point, and the result will be
|
||||
saved in .env. This helps to avoid losing the real configurations.
|
||||
|
||||
$ cp .env .env.bak
|
||||
$ lamassu-server-stress-testing env --inenv .env.bak --outenv .env
|
||||
|
||||
The database chosen in the command above (by default 'lamassu_stress') must be
|
||||
initialized, and must have a bare-bones configuration. The following command
|
||||
takes care of it:
|
||||
|
||||
$ lamassu-server-stress-testing db
|
||||
|
||||
You also need to create fake machines that will be used later in the actual
|
||||
stress tests (including certificates, and pairing each to the server). The
|
||||
following command creates 10 fake machines, and saves their device IDs in
|
||||
path/to/machine-ids.txt. path/to/real/machine/code/ is the path to the root of
|
||||
the machine's code.
|
||||
|
||||
$ lamassu-server-stress-testing machines -n 10 --device_ids_path path/to/machine-ids.txt --machine path/to/real/machine/code/ --replace_existing
|
||||
|
||||
Finally, use the following to start the lamassu-server in stress-testing mode:
|
||||
|
||||
$ lamassu-server-stress-testing server
|
||||
`
|
||||
|
||||
const rightpad = (s, w, c) => s + c.repeat(Math.max(w - s.length, 0))
|
||||
|
||||
const help = exit_code => {
|
||||
console.log('Usage: lamassu-server-stress-testing SUBCMD ARGS...')
|
||||
console.log('Where SUBCMD is one of the following:')
|
||||
const max_subcmd_length = Math.max(
|
||||
...Object.keys(SUBCMDS).map(subcmd => subcmd.length),
|
||||
)
|
||||
Object.entries(SUBCMDS).forEach(([subcmd, { help_message }]) => {
|
||||
console.log(
|
||||
`\t${rightpad(subcmd, max_subcmd_length, ' ')}\t${help_message ?? ''}`,
|
||||
)
|
||||
})
|
||||
|
||||
console.log(README)
|
||||
|
||||
return exit_code
|
||||
}
|
||||
|
||||
const main = async args => {
|
||||
try {
|
||||
const subcmd = SUBCMDS[args[0]]
|
||||
|
||||
const exit_code =
|
||||
args.length === 0
|
||||
? help(EXIT.OK)
|
||||
: !subcmd
|
||||
? help(EXIT.BADARGS)
|
||||
: await subcmd.run(args.slice(1))
|
||||
|
||||
process.exit(exit_code ?? EXIT.UNKNOWN)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
process.exit(EXIT.EXCEPTION)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = main
|
||||
Loading…
Add table
Add a link
Reference in a new issue