From 8b53644f1443b406adbd4a60bed03a1a006b6e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Wed, 27 Jan 2021 18:34:28 +0000 Subject: [PATCH] fix: stress-test on virgin servers --- package.json | 2 +- test/stress/scripts/create-machines.sh | 6 ++++++ test/stress/utils/default-config.json | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 test/stress/utils/default-config.json diff --git a/package.json b/package.json index 5dde83cb..beada3fb 100644 --- a/package.json +++ b/package.json @@ -116,7 +116,7 @@ "admin-server": "nodemon bin/lamassu-admin-server --dev", "graphql-server": "nodemon bin/new-graphql-dev-insecure", "watch": "concurrently \"npm:server\" \"npm:admin-server\" \"npm:graphql-server\"", - "stress-test": "cd ./test/stress/ && node index.js 50 -v" + "stress-test": "cd ./test/stress/ && node index.js 5 -v" }, "nodemonConfig": { "ignore": [ diff --git a/test/stress/scripts/create-machines.sh b/test/stress/scripts/create-machines.sh index d85b065d..7cc5526b 100644 --- a/test/stress/scripts/create-machines.sh +++ b/test/stress/scripts/create-machines.sh @@ -46,12 +46,18 @@ EOL # Update db config sudo -u postgres psql -t -d lamassu_stress -c "select data from user_config where type='config' order by id desc limit 1" > config.json + if [[ -s config.json ]] + then NEW_CONFIG=$(node ./utils/save-config.js $NUMBER $DEVICE_ID) sudo -u postgres psql "lamassu_stress" << EOF insert into user_config(type, data, created, valid) values('config', '$NEW_CONFIG', now(), 't') EOF + else + echo "file is empty" + fi + # Add device on db sudo -u postgres psql "lamassu_stress" << EOF insert into devices(device_id, cashbox, cassette1, cassette2, paired, display, created, name, last_online, location) diff --git a/test/stress/utils/default-config.json b/test/stress/utils/default-config.json new file mode 100644 index 00000000..565d2869 --- /dev/null +++ b/test/stress/utils/default-config.json @@ -0,0 +1,2 @@ +{"config":{"wallets_BTC_coin":"BTC","wallets_BTC_wallet":"mock-wallet","wallets_BTC_ticker":"mock-ticker","wallets_BTC_exchange":"mock-exchange","wallets_BTC_zeroConf":"all-zero-conf","locale_id":"32cc539a-78e6-4a1d-96d8-31b7aa628e1f","locale_country":"US","locale_fiatCurrency":"USD","locale_languages":["en-US"],"locale_cryptoCurrencies":["BTC"],"commissions_minimumTx":1,"commissions_fixedFee":1,"commissions_cashOut":1,"commissions_cashIn":1,"commissions_id":"719b9dd9-1444-42fc-918a-f8b2265513ac"}} +