Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5328 from LiskHQ/5250-remove_storage
Browse files Browse the repository at this point in the history
Remove storage and cache from components - Closes #5260
  • Loading branch information
shuse2 authored May 15, 2020
2 parents a832d30 + 613f306 commit 1d99862
Show file tree
Hide file tree
Showing 401 changed files with 180 additions and 33,148 deletions.
156 changes: 11 additions & 145 deletions Jenkinsfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,25 @@
def setup(start_application=false) {
cleanWs()
unstash 'build'
sh '''
for database in $( psql --tuples-only --command='SELECT datname FROM pg_database WHERE datdba = (SELECT usesysid FROM pg_user WHERE usename = current_user);' |awk '{ print $1 }' ); do
dropdb --if-exists $database
done
createdb lisk_dev
rm -rf /tmp/jest_rt/
'''
if(start_application) {
nvm(getNodejsVersion()) {
dir('framework') {
sh '''
# teardown_*() should have killed all node processes but we want to be sure
# this shouldn't hurt assuming the 'lisk-core' jenkins nodes have 1 executor
killall --verbose --wait node || true
NODE_ENV=test LISK_CONSOLE_LOG_LEVEL=debug NEWRELIC_LICENSE_KEY= node test/test_app >.app.log 2>&1 &
NODE_ENV=test LISK_CONSOLE_LOG_LEVEL=debug node test/test_app >.app.log 2>&1 &
'''
}
}
// wait for the Core API to be reachable
timeout(1) {
waitUntil {
script {
def api_available = sh script: 'curl http://localhost:4000/api/node/constants >/dev/null', returnStatus: true
return (api_available == 0)
}
}
}
}
}

def run_mocha(test_name) {
ansiColor('xterm') {
timestamps {
nvm(getNodejsVersion()) {
dir('framework') {
sh 'npm run mocha:' + "${test_name}" + ' ${MOCHA_OPTIONS:-$DEFAULT_MOCHA_OPTIONS}'
}
}
}
// timeout(1) {
// waitUntil {
// script {
// def api_available = sh script: 'curl http://localhost:4000/api/node/constants >/dev/null', returnStatus: true
// return (api_available == 0)
// }
// }
// }
}
}

Expand All @@ -50,46 +30,14 @@ def run_jest(test_name) {
timestamps {
nvm(getNodejsVersion()) {
dir('framework') {
sh 'npm run jest:' + "${test_name}" + ' ${JEST_OPTIONS}'
sh 'npm run test:' + "${test_name}" + ' ${JEST_OPTIONS}'
}
}
}
}
}

def teardown_mocha(test_name) {
// teardown_mocha() gets called in post actions and so we don't want it to fail
try {
nvm(getNodejsVersion()) {
dir('framework') {
sh """
rm -rf coverage_mocha_${test_name}; mkdir -p coverage_mocha_${test_name}
cp test/mocha/.coverage-${test_name}/* coverage_mocha_${test_name}/ || true
"""
}
}
} catch(err) {
println "Could gather coverage statistics from mocha:\n${err}"
}
dir('framework') {
stash name: "coverage_mocha_${test_name}", includes: "coverage_mocha_${test_name}/*", allowEmpty: true
}
timeout(1) {
sh 'killall --verbose --wait node || true'
}
dir('framework') {
sh """
mv .app.log lisk_${test_name}.stdout.txt || true
mv logs/devnet/lisk.log lisk_${test_name}.log || true
"""
archiveArtifacts artifacts: 'lisk_*.log', allowEmptyArchive: true
archiveArtifacts artifacts: 'lisk_*.stdout.txt', allowEmptyArchive: true
}
cleanWs()
}

def teardown_jest(test_name) {
// teardown_mocha() gets called in post actions and so we don't want it to fail
try {
nvm(getNodejsVersion()) {
sh """
Expand All @@ -98,7 +46,7 @@ def teardown_jest(test_name) {
"""
}
} catch(err) {
println "Could gather coverage statistics from jest:\n${err}"
println "Could gather coverage statistics from test:\n${err}"
}
stash name: "coverage_jest_${test_name}", includes: "coverage_jest_${test_name}/*", allowEmpty: true
timeout(1) {
Expand All @@ -117,13 +65,11 @@ def teardown_jest(test_name) {

properties([
parameters([
string(name: 'MOCHA_OPTIONS', defaultValue: '-- --grep @slow|@unstable --invert', description: 'Please check readme to see available test tags. Example: `-- --grep something`', ),
string(name: 'JEST_OPTIONS', defaultValue: '', description: 'Additional jest options that you want to provide to test runner. Example: `-- --config=<path>`'),
// read by the application
string(name: 'LOG_LEVEL', defaultValue: 'error', description: 'To get desired build log output change the log level', ),
string(name: 'FILE_LOG_LEVEL', defaultValue: 'error', description: 'To get desired file log output change the log level', ),
// used by tests
string(name: 'LOG_DB_EVENTS', defaultValue: 'false', description: 'To get detailed info on db events log.', ),
string(name: 'SILENT', defaultValue: 'true', description: 'To turn off test debug logs.', )
])
])
Expand All @@ -133,7 +79,6 @@ pipeline {

environment {
MAX_TASK_LIMIT = '20'
DEFAULT_MOCHA_OPTIONS = "-- --grep @slow|@unstable --invert"
}

stages {
Expand Down Expand Up @@ -238,13 +183,6 @@ pipeline {
yarn build
'''
}
sh '''
for database in $( psql --tuples-only --command='SELECT datname FROM pg_database WHERE datdba = (SELECT usesysid FROM pg_user WHERE usename = current_user);' |awk '{ print $1 }' ); do
dropdb --if-exists $database
done
createdb lisk_dev
rm -rf /tmp/jest_rt/
'''
run_jest('integration')
}
post {
Expand All @@ -267,72 +205,6 @@ pipeline {
}
}
}
stage('Legacy Framework test (mocha)') {
parallel {
/*
stage('Functional HTTP GET tests') {
agent { node { label 'lisk-framework' }}
steps {
setup(true)
run_mocha('functional:get')
}
post {
cleanup {
teardown_mocha('get')
}
}
}
stage('Functional HTTP POST tests') {
agent { node { label 'lisk-framework' }}
steps {
setup(true)
run_mocha('functional:post')
}
post {
cleanup {
teardown_mocha('post')
}
}
}
stage('Functional HTTP PUT tests') {
agent { node { label 'lisk-framework' }}
steps {
setup(true)
run_mocha('functional:put')
}
post {
cleanup {
teardown_mocha('put')
}
}
}
stage ('Functional WS tests') {
agent { node { label 'lisk-framework' }}
steps {
setup(true)
run_mocha('functional:ws')
}
post {
cleanup {
teardown_mocha('ws')
}
}
}
*/
stage('Unit tests') {
agent { node { label 'lisk-framework' }}
steps {
setup()
run_mocha('unit')
}
post {
cleanup {
teardown_mocha('unit')
}
}
}
}
}
}
post {
always {
Expand All @@ -352,18 +224,12 @@ pipeline {
} catch(err) {
println "Could not unstash jest_unit. Continuing."
}
try {
unstash "coverage_mocha_unit"
} catch(err) {
println "Could not unstash mocha_unit. Continuing."
}
sh '''
rm -rf .nyc_output; mkdir -p .nyc_output
rm -rf ci_coverage; mkdir -p ci_coverage
cp -r coverage_elements/* ./.nyc_output
cp -r coverage_commander/* ./.nyc_output
cp coverage_jest_unit/coverage-final.json ./.nyc_output/coverage-framework-unit.json
cp -r coverage_mocha_unit/* ./.nyc_output
'''
try {
nvm(getNodejsVersion()) {
Expand Down
1 change: 0 additions & 1 deletion framework/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ mocha.opts

# Ignore extensions
*.png
*.sql
## jest snapshot
*.snap

Expand Down
68 changes: 0 additions & 68 deletions framework/Jenkinsfile.network

This file was deleted.

Loading

0 comments on commit 1d99862

Please sign in to comment.