Skip to content

Commit b699f05

Browse files
committed
Run integration tests in parallel
1 parent f7c87f6 commit b699f05

File tree

2 files changed

+63
-58
lines changed

2 files changed

+63
-58
lines changed

Jenkinsfile

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -100,59 +100,62 @@ pipeline {
100100
}
101101
}
102102
}
103-
stage('Integration Tests Sqlite') {
104-
steps {
105-
// Bring up a stack
106-
sh 'docker-compose up -d fullstack-sqlite'
107-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
108-
// Stop and Start it, as this will test it's ability to restart with existing data
109-
sh 'docker-compose stop fullstack-sqlite'
110-
sh 'docker-compose start fullstack-sqlite'
111-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
103+
stage('Integration Tests') {
104+
parallel {
105+
stage('Sqlite') {
106+
steps {
107+
// Bring up a stack
108+
sh 'docker-compose up -d fullstack-sqlite'
109+
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
110+
// Stop and Start it, as this will test it's ability to restart with existing data
111+
sh 'docker-compose stop fullstack-sqlite'
112+
sh 'docker-compose start fullstack-sqlite'
113+
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
112114

113-
// Run tests
114-
sh 'rm -rf test/results'
115-
sh 'docker-compose up cypress-sqlite'
116-
// Get results
117-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/'
118-
}
119-
post {
120-
always {
121-
// Dumps to analyze later
122-
sh 'mkdir -p debug'
123-
sh 'docker-compose logs fullstack-sqlite > debug/docker_fullstack_sqlite.log'
124-
sh 'docker-compose logs db > debug/docker_db.log'
125-
// Cypress videos and screenshot artifacts
126-
dir(path: 'test/results') {
127-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
128-
}
129-
junit 'test/results/junit/*'
115+
// Run tests
116+
sh 'rm -rf test/results-sqlite'
117+
sh 'docker-compose up cypress-sqlite'
118+
// Get results
119+
sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/results-sqlite'
120+
}
121+
post {
122+
always {
123+
// Dumps to analyze later
124+
sh 'mkdir -p debug/sqlite'
125+
sh 'docker-compose logs fullstack-sqlite > debug/sqlite/docker_fullstack_sqlite.log'
126+
// Cypress videos and screenshot artifacts
127+
dir(path: 'test/results-sqlite') {
128+
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
129+
}
130+
junit 'test/results-sqlite/junit/*'
131+
}
132+
}
130133
}
131-
}
132-
}
133-
stage('Integration Tests Mysql') {
134-
steps {
135-
// Bring up a stack
136-
sh 'docker-compose up -d fullstack-mysql'
137-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
134+
stage('Mysql') {
135+
steps {
136+
// Bring up a stack
137+
sh 'docker-compose up -d fullstack-mysql'
138+
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
138139

139-
// Run tests
140-
sh 'rm -rf test/results'
141-
sh 'docker-compose up cypress-mysql'
142-
// Get results
143-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/'
144-
}
145-
post {
146-
always {
147-
// Dumps to analyze later
148-
sh 'mkdir -p debug'
149-
sh 'docker-compose logs fullstack-mysql > debug/docker_fullstack_mysql.log'
150-
sh 'docker-compose logs db > debug/docker_db.log'
151-
// Cypress videos and screenshot artifacts
152-
dir(path: 'test/results') {
153-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
154-
}
155-
junit 'test/results/junit/*'
140+
// Run tests
141+
sh 'rm -rf test/results-mysql'
142+
sh 'docker-compose up cypress-mysql'
143+
// Get results
144+
sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/results-mysql'
145+
}
146+
post {
147+
always {
148+
// Dumps to analyze later
149+
sh 'mkdir -p debug/mysql'
150+
sh 'docker-compose logs fullstack-mysql > debug/mysql/docker_fullstack_mysql.log'
151+
sh 'docker-compose logs db > debug/mysql/docker_db.log'
152+
// Cypress videos and screenshot artifacts
153+
dir(path: 'test/results-mysql') {
154+
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
155+
}
156+
junit 'test/results-mysql/junit/*'
157+
}
158+
}
156159
}
157160
}
158161
}

docker/docker-compose.ci.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ services:
1414
DB_MYSQL_PASSWORD: 'npm'
1515
DB_MYSQL_NAME: 'npm'
1616
volumes:
17-
- npm_data:/data
17+
- npm_data_mysql:/data
1818
expose:
1919
- 81
2020
- 80
@@ -37,7 +37,7 @@ services:
3737
PGID: 1000
3838
DISABLE_IPV6: 'true'
3939
volumes:
40-
- npm_data:/data
40+
- npm_data_sqlite:/data
4141
expose:
4242
- 81
4343
- 80
@@ -55,7 +55,7 @@ services:
5555
MYSQL_USER: 'npm'
5656
MYSQL_PASSWORD: 'npm'
5757
volumes:
58-
- db_data:/var/lib/mysql
58+
- mysql_data:/var/lib/mysql
5959

6060
cypress-mysql:
6161
image: "${IMAGE}-cypress:ci-${BUILD_NUMBER}"
@@ -65,7 +65,7 @@ services:
6565
environment:
6666
CYPRESS_baseUrl: 'http://fullstack-mysql:81'
6767
volumes:
68-
- cypress-logs:/results
68+
- cypress_logs_mysql:/results
6969
command: cypress run --browser chrome --config-file=${CYPRESS_CONFIG:-cypress/config/ci.json}
7070

7171
cypress-sqlite:
@@ -76,10 +76,12 @@ services:
7676
environment:
7777
CYPRESS_baseUrl: "http://fullstack-sqlite:81"
7878
volumes:
79-
- cypress-logs:/results
79+
- cypress_logs_sqlite:/results
8080
command: cypress run --browser chrome --config-file=${CYPRESS_CONFIG:-cypress/config/ci.json}
8181

8282
volumes:
83-
cypress-logs:
84-
npm_data:
85-
db_data:
83+
cypress_logs_mysql:
84+
cypress_logs_sqlite:
85+
npm_data_mysql:
86+
npm_data_sqlite:
87+
mysql_data:

0 commit comments

Comments
 (0)