Skip to content

Commit 6ac9a82

Browse files
committed
Major update to cypress
- Updated cypress - Ground work for testing DNS certs in CI
1 parent 3754a56 commit 6ac9a82

32 files changed

+1382
-1176
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
._*
44
.vscode
55
certbot-help.txt
6+
test/node_modules
7+
*/node_modules
8+
docker/dev/dnsrouter-config.json.tmp
9+
docker/dev/resolv.conf

Jenkinsfile

+52-68
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ pipeline {
1818
BUILD_VERSION = getVersion()
1919
MAJOR_VERSION = '2'
2020
BRANCH_LOWER = "${BRANCH_NAME.toLowerCase().replaceAll('\\\\', '-').replaceAll('/', '-').replaceAll('\\.', '-')}"
21-
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
22-
COMPOSE_FILE = 'docker/docker-compose.ci.yml'
21+
BUILDX_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}"
2322
COMPOSE_INTERACTIVE_NO_CLI = 1
24-
BUILDX_NAME = "${COMPOSE_PROJECT_NAME}"
2523
}
2624
stages {
2725
stage('Environment') {
@@ -94,75 +92,61 @@ pipeline {
9492
}
9593
}
9694
}
97-
stage('Cypress') {
98-
steps {
99-
// Creating will also create the network prior to
100-
// using it in parallel stages below and mitigating
101-
// a race condition.
102-
sh 'docker-compose build cypress-sqlite'
103-
sh 'docker-compose build cypress-mysql'
104-
sh 'docker-compose create cypress-sqlite'
105-
sh 'docker-compose create cypress-mysql'
106-
}
95+
}
96+
}
97+
stage('Test Sqlite') {
98+
environment {
99+
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}_sqlite"
100+
COMPOSE_FILE = 'docker/docker-compose.ci.yml:docker/docker-compose.ci.sqlite.yml'
101+
}
102+
when {
103+
not {
104+
equals expected: 'UNSTABLE', actual: currentBuild.result
105+
}
106+
}
107+
steps {
108+
sh 'rm -rf ./test/results/junit/*'
109+
sh './scripts/ci/fulltest-cypress'
110+
}
111+
post {
112+
always {
113+
// Dumps to analyze later
114+
sh 'mkdir -p debug/sqlite'
115+
sh 'docker logs $(docker-compose ps --all -q fullstack) > debug/sqlite/docker_fullstack.log 2>&1'
116+
sh 'docker logs $(docker-compose ps --all -q stepca) > debug/sqlite/docker_stepca.log 2>&1'
117+
sh 'docker logs $(docker-compose ps --all -q pdns) > debug/sqlite/docker_pdns.log 2>&1'
118+
sh 'docker logs $(docker-compose ps --all -q pdns-db) > debug/sqlite/docker_pdns-db.log 2>&1'
119+
sh 'docker logs $(docker-compose ps --all -q dnsrouter) > debug/sqlite/docker_dnsrouter.log 2>&1'
120+
junit 'test/results/junit/*'
121+
sh 'docker-compose down --remove-orphans --volumes -t 30 || true'
107122
}
108123
}
109124
}
110-
stage('Integration Tests') {
111-
parallel {
112-
stage('Sqlite') {
113-
steps {
114-
// Bring up a stack
115-
sh 'docker-compose up -d fullstack-sqlite'
116-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
117-
// Stop and Start it, as this will test it's ability to restart with existing data
118-
sh 'docker-compose stop fullstack-sqlite'
119-
sh 'docker-compose start fullstack-sqlite'
120-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-sqlite) 120'
121-
122-
// Run tests
123-
sh 'rm -rf test/results-sqlite'
124-
sh 'docker-compose up cypress-sqlite'
125-
// Get results
126-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-sqlite):/test/results" test/results-sqlite'
127-
}
128-
post {
129-
always {
130-
// Dumps to analyze later
131-
sh 'mkdir -p debug/sqlite'
132-
sh 'docker-compose logs fullstack-sqlite > debug/sqlite/docker_fullstack_sqlite.log'
133-
// Cypress videos and screenshot artifacts
134-
dir(path: 'test/results-sqlite') {
135-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
136-
}
137-
junit 'test/results-sqlite/junit/*'
138-
}
139-
}
125+
stage('Test Mysql') {
126+
environment {
127+
COMPOSE_PROJECT_NAME = "npm_${BRANCH_LOWER}_${BUILD_NUMBER}_mysql"
128+
COMPOSE_FILE = 'docker/docker-compose.ci.yml:docker/docker-compose.ci.mysql.yml'
129+
}
130+
when {
131+
not {
132+
equals expected: 'UNSTABLE', actual: currentBuild.result
140133
}
141-
stage('Mysql') {
142-
steps {
143-
// Bring up a stack
144-
sh 'docker-compose up -d fullstack-mysql'
145-
sh './scripts/wait-healthy $(docker-compose ps --all -q fullstack-mysql) 120'
146-
147-
// Run tests
148-
sh 'rm -rf test/results-mysql'
149-
sh 'docker-compose up cypress-mysql'
150-
// Get results
151-
sh 'docker cp -L "$(docker-compose ps --all -q cypress-mysql):/test/results" test/results-mysql'
152-
}
153-
post {
154-
always {
155-
// Dumps to analyze later
156-
sh 'mkdir -p debug/mysql'
157-
sh 'docker-compose logs fullstack-mysql > debug/mysql/docker_fullstack_mysql.log'
158-
sh 'docker-compose logs db > debug/mysql/docker_db.log'
159-
// Cypress videos and screenshot artifacts
160-
dir(path: 'test/results-mysql') {
161-
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*', excludes: '**/*.xml'
162-
}
163-
junit 'test/results-mysql/junit/*'
164-
}
165-
}
134+
}
135+
steps {
136+
sh 'rm -rf ./test/results/junit/*'
137+
sh './scripts/ci/fulltest-cypress'
138+
}
139+
post {
140+
always {
141+
// Dumps to analyze later
142+
sh 'mkdir -p debug/mysql'
143+
sh 'docker logs $(docker-compose ps --all -q fullstack) > debug/mysql/docker_fullstack.log 2>&1'
144+
sh 'docker logs $(docker-compose ps --all -q stepca) > debug/mysql/docker_stepca.log 2>&1'
145+
sh 'docker logs $(docker-compose ps --all -q pdns) > debug/mysql/docker_pdns.log 2>&1'
146+
sh 'docker logs $(docker-compose ps --all -q pdns-db) > debug/mysql/docker_pdns-db.log 2>&1'
147+
sh 'docker logs $(docker-compose ps --all -q dnsrouter) > debug/mysql/docker_dnsrouter.log 2>&1'
148+
junit 'test/results/junit/*'
149+
sh 'docker-compose down --remove-orphans --volumes -t 30 || true'
166150
}
167151
}
168152
}

docker/dev/dnsrouter-config.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"log": {
3+
"format": "nice",
4+
"level": "debug"
5+
},
6+
"servers": [
7+
{
8+
"host": "0.0.0.0",
9+
"port": 53,
10+
"upstreams": [
11+
{
12+
"regex": "website[0-9]+.example\\.com",
13+
"upstream": "127.0.0.11"
14+
},
15+
{
16+
"regex": ".*\\.example\\.com",
17+
"upstream": "1.1.1.1"
18+
},
19+
{
20+
"regex": "local",
21+
"nxdomain": true
22+
}
23+
],
24+
"internal": null,
25+
"default_upstream": "127.0.0.11"
26+
}
27+
]
28+
}

docker/dev/letsencrypt.ini

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
text = True
2+
non-interactive = True
3+
webroot-path = /data/letsencrypt-acme-challenge
4+
key-type = ecdsa
5+
elliptic-curve = secp384r1
6+
preferred-chain = ISRG Root X1
7+
server =

0 commit comments

Comments
 (0)