feat: wrapper to a single entrypoint to the stress test
This commit is contained in:
parent
7794b91d20
commit
722a3d2853
4 changed files with 34 additions and 10 deletions
|
|
@ -20,13 +20,14 @@ fi
|
|||
rm -rf ./machines/*
|
||||
|
||||
# Create stress database
|
||||
# sudo -u postgres psql postgres -c "drop database if exists lamassu_stress"
|
||||
# sudo -u postgres psql postgres -c "create database lamassu_stress with template lamassu"
|
||||
sudo -u postgres psql postgres -c "drop database if exists lamassu_stress"
|
||||
sudo -u postgres psql postgres -c "create database lamassu_stress with template lamassu"
|
||||
|
||||
START=1
|
||||
END=$1
|
||||
for (( c=$START; c<=$END; c++ ))
|
||||
do
|
||||
echo "Creating machine $c out of $END..."
|
||||
NUMBER=$c
|
||||
mkdir -p ./machines/$NUMBER/
|
||||
cp "$3"/data/client.sample.pem ./machines/$NUMBER/
|
||||
|
|
@ -44,15 +45,15 @@ EOL
|
|||
DEVICE_ID=`openssl x509 -outform der -in ./machines/$NUMBER/client.pem | sha256sum | cut -d " " -f 1`
|
||||
|
||||
# Update db config
|
||||
sudo -u postgres psql -t -d lamassu -c "select data from user_config where type='config' order by id desc limit 1" > config.json
|
||||
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
|
||||
NEW_CONFIG=$(node ./utils/save-config.js $NUMBER $DEVICE_ID)
|
||||
sudo -u postgres psql "lamassu" << EOF
|
||||
sudo -u postgres psql "lamassu_stress" << EOF
|
||||
insert into user_config(type, data, created, valid)
|
||||
values('config', '$NEW_CONFIG', now(), 't')
|
||||
EOF
|
||||
|
||||
# Add device on db
|
||||
sudo -u postgres psql "lamassu" << EOF
|
||||
sudo -u postgres psql "lamassu_stress" << EOF
|
||||
insert into devices(device_id, cashbox, cassette1, cassette2, paired, display, created, name, last_online, location)
|
||||
values ('$DEVICE_ID', 0, 0, 0, 't', 't', now(), $NUMBER, now(), '{}'::json)
|
||||
EOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue