Skip to content

Commit

Permalink
Test against core 0.9.12a from lisk-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
francoilol committed Apr 3, 2018
1 parent 992e1b8 commit 3049bbe
Showing 1 changed file with 21 additions and 32 deletions.
53 changes: 21 additions & 32 deletions Jenkinsfile
Expand Up @@ -40,34 +40,6 @@ node('lisk-hub') {
echo "Error: ${err}"
fail('Stopping build: checkout failed')
}

try {
sh '''
N=${EXECUTOR_NUMBER:-0}; N=$((N+1))
cd ~/lisk-Linux-x86_64
# work around core bug: config.json gets overwritten; use backup
cp .config.json config_$N.json
# change core port, listen only on 127.0.0.1
sed -i -r -e "s/^(.*ort\\":) 4000,/\\1 400$N,/" config_$N.json
sed -i -r -e "s/^(.*\\"address\\":) \\"0.0.0.0\\",/\\1 \\"127.0.0.1\\",/" config_$N.json
# disable redis
sed -i -r -e "s/^(\\s*\\"cacheEnabled\\":) true/\\1 false/" config_$N.json
# change postgres databse
sed -i -r -e "s/^(\\s*\\"database\\": \\"lisk_test)\\",/\\1_$N\\",/" config_$N.json
cp etc/pm2-lisk.json etc/pm2-lisk_$N.json
sed -i -r -e "s/config.json/config_$N.json/" etc/pm2-lisk_$N.json
sed -i -r -e "s/(lisk.app)/\\1_$N/" etc/pm2-lisk_$N.json
# logs
sed -i -r -e "s/lisk.log/lisk_${JOB_BASE_NAME}_${BUILD_ID}.log/" config_$N.json
sed -i -r -e "s/lisk.app_$N/lisk.app_$N_${JOB_BASE_NAME}_${BUILD_ID}/" etc/pm2-lisk_$N.json
#
JENKINS_NODE_COOKIE=dontKillMe bash lisk.sh start_db -p etc/pm2-lisk_$N.json
bash lisk.sh rebuild -p etc/pm2-lisk_$N.json -f blockchain_explorer.db.gz
'''
} catch (err) {
echo "Error: ${err}"
fail('Stopping build: Lisk Core failed to start')
}
}

stage ('Install npm dependencies') {
Expand Down Expand Up @@ -145,16 +117,23 @@ node('lisk-hub') {
export DISPLAY=:1$N
Xvfb :1$N -ac -screen 0 1280x1024x24 &
cp -r ~/lisk-docker/examples/development $WORKSPACE/$BRANCH_NAME
cd $WORKSPACE/$BRANCH_NAME
cp /home/lisk/blockchain_explorer.db.gz ./blockchain.db.gz
LISK_VERSION=0.9.12a make coldstart
LISK_PORT=$( docker-compose port lisk 4000 |cut -d ":" -f 2 )
cd -
# Run end-to-end tests
npm run serve -- $WORKSPACE/app/build -p 300$N -a 127.0.0.1 &>server.log &
if [ -z $CHANGE_BRANCH ]; then
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:400$N --cucumberOpts.tags @advanced
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:$LISK_PORT --cucumberOpts.tags @advanced
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL https://testnet.lisk.io --cucumberOpts.tags @testnet --params.useTestnetPassphrase true
else
echo "Skipping @testnet end-to-end tests because we're not on 'development' branch"
fi
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:400$N
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --params.liskCoreURL http://127.0.0.1:$LISK_PORT
if [ -z $CHANGE_BRANCH ]; then
npm run --silent e2e-test -- --params.baseURL http://127.0.0.1:300$N --cucumberOpts.tags @testnet --params.useTestnetPassphrase true --params.network testnet
else
Expand All @@ -170,11 +149,21 @@ node('lisk-hub') {
}
} catch(err) {
echo "Error: ${err}"
ansiColor('xterm') {
sh '''
cd $WORKSPACE/$BRANCH_NAME
docker-compose logs
'''
}
} finally {
ansiColor('xterm') {
sh '''
cd $WORKSPACE/$BRANCH_NAME
make mrproper
'''
}
sh '''
N=${EXECUTOR_NUMBER:-0}; N=$((N+1))
curl --verbose http://127.0.0.1:400$N/api/blocks/getNethash || true
( cd ~/lisk-Linux-x86_64 && bash lisk.sh stop_node -p etc/pm2-lisk_$N.json ) || true
pgrep --list-full -f "Xvfb :1$N" || true
pkill --echo -f "Xvfb :1$N" -9 || echo "pkill returned code $?"
Expand Down

0 comments on commit 3049bbe

Please sign in to comment.