Skip to content

Commit e72b1f9

Browse files
authored
Merge pull request #1293 from bcgov/cypress/kong3
Upgrade e2e testing to use Kong Gateway 3.9.1, along with associated infrastructure and dependency updates, plus test improvements and fixes.
2 parents f4a61d8 + d50b684 commit e72b1f9

38 files changed

+210
-84
lines changed

.github/workflows/aps-cypress-e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
steps:
2424
- name: Build GWA API Image
2525
run: |
26-
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.40
26+
git clone https://github.com/bcgov/gwa-api.git --branch v1.0.47
2727
cd gwa-api/microservices/gatewayApi
2828
docker build -t gwa-api:e2e .
2929

docker-compose.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
x-common-variables: &common-variables
42
KONG_DATABASE: postgres
53
KONG_PG_DATABASE: kong
@@ -13,7 +11,8 @@ services:
1311
container_name: keycloak
1412
hostname: keycloak
1513
depends_on:
16-
- kong-db
14+
kong-db:
15+
condition: service_healthy
1716
command:
1817
[
1918
'-b',
@@ -103,7 +102,7 @@ services:
103102
networks:
104103
- aps-net
105104
kong-db:
106-
image: postgres:12.8
105+
image: postgres:14
107106
container_name: kong-db
108107
environment:
109108
POSTGRES_USER: postgres
@@ -115,13 +114,19 @@ services:
115114
volumes:
116115
- ./local/db/database-init.sql:/docker-entrypoint-initdb.d/1-init.sql
117116
- ./local/db/keystone-init.sql:/docker-entrypoint-initdb.d/2-init.sql
117+
healthcheck:
118+
test: ["CMD-SHELL", "pg_isready -U postgres"]
119+
interval: 5s
120+
timeout: 5s
121+
retries: 10
118122
networks:
119123
- aps-net
120124
kong-migrations:
121125
image: kong:kong-local
122126
command: kong migrations bootstrap
123127
depends_on:
124-
- kong-db
128+
kong-db:
129+
condition: service_healthy
125130
environment:
126131
<<: *common-variables
127132
KONG_DNS_ORDER: 'LAST,A'
@@ -135,8 +140,10 @@ services:
135140
image: kong:kong-local
136141
command: kong migrations up && kong migrations finish
137142
depends_on:
138-
- kong-db
139-
- kong-migrations
143+
kong-db:
144+
condition: service_healthy
145+
kong-migrations:
146+
condition: service_completed_successfully
140147
environment:
141148
<<: *common-variables
142149
KONG_DNS_ORDER: 'LAST,A'
@@ -216,15 +223,15 @@ services:
216223
entrypoint: sh -c "chmod +x /tmp/entrypoint.sh && /tmp/entrypoint.sh"
217224
environment:
218225
- BROWSER=edge
219-
- CYPRESS_RECORD_KEY=${CY_RECORD_KEY}
220-
- CYPRESS_PROJECT_ID=${CY_PROJECT_ID}
221-
- RUN_ENV=${CY_EXECUTION_ENV}
222-
- COMMIT_INFO_BRANCH=${CY_COMMIT_BRANCH}
223-
- COMMIT_INFO_SHA=${CY_COMMIT_SHA}
224-
- COMMIT_INFO_AUTHOR=${CY_COMMIT_AUTHOR}
225-
- COMMIT_INFO_MESSAGE=${CY_COMMIT_MESSAGE}
226-
- COMMIT_INFO_REMOTE=${CY_REPO_URL}
227-
- COMMIT_INFO_EMAIL=${CY_COMMIT_AUTHOR_EMAIL}
226+
- CYPRESS_RECORD_KEY=${CY_RECORD_KEY:-}
227+
- CYPRESS_PROJECT_ID=${CY_PROJECT_ID:-}
228+
- RUN_ENV=${CY_EXECUTION_ENV:-}
229+
- COMMIT_INFO_BRANCH=${CY_COMMIT_BRANCH:-}
230+
- COMMIT_INFO_SHA=${CY_COMMIT_SHA:-}
231+
- COMMIT_INFO_AUTHOR=${CY_COMMIT_AUTHOR:-}
232+
- COMMIT_INFO_MESSAGE=${CY_COMMIT_MESSAGE:-}
233+
- COMMIT_INFO_REMOTE=${CY_REPO_URL:-}
234+
- COMMIT_INFO_EMAIL=${CY_COMMIT_AUTHOR_EMAIL:-}
228235
depends_on:
229236
- feeder-seeding
230237
build:

e2e/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM cypress/included:12.17.4
1+
FROM cypress/included:13.17.0
22

33
# Copy of the source for code coverage analysis
44
WORKDIR /app
@@ -22,7 +22,7 @@ COPY e2e/*.yml /e2e
2222
COPY e2e/entrypoint.sh /tmp
2323
ADD e2e/cypress /e2e/cypress
2424

25-
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.5/gwa_Linux_x86_64.tgz \
25+
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.6/gwa_Linux_x86_64.tgz \
2626
&& tar -xzf gwa_Linux_x86_64.tgz \
2727
&& mv gwa /usr/local/bin/.
2828

e2e/cypress.config.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ export default defineConfig({
1515
// You may want to clean this up later by importing these.
1616
setupNodeEvents(on, config) {
1717
require('dotenv').config()
18-
require('@cypress/code-coverage/task')(on, config)
18+
// Only enable code coverage in CI or when explicitly enabled
19+
if (process.env.CI || process.env.ENABLE_COVERAGE === 'true') {
20+
require('@cypress/code-coverage/task')(on, config)
21+
}
1922

2023
// // It's IMPORTANT to return the config object
2124
// // with any changed environment variables
@@ -26,7 +29,7 @@ export default defineConfig({
2629
'./cypress/tests/07-*/*.ts',
2730
'./cypress/tests/03-*/*.ts',
2831
'./cypress/tests/04-*/*.ts',
29-
// './cypress/tests/05-*/*.ts',
32+
'./cypress/tests/05-*/*.ts',
3033
'./cypress/tests/08-*/*.ts',
3134
'./cypress/tests/09-*/*.ts',
3235
'./cypress/tests/10-*/*.ts',
@@ -74,6 +77,10 @@ export default defineConfig({
7477
WEBAPP_URL: 'http://html-sample-app.localtest.me:4242',
7578
DEV_USERNAME: 'janis@idir',
7679
DEV_PASSWORD: 'awsummer',
80+
HAS_KUBE_API: false,
81+
// Pass CI flag to browser context for code coverage
82+
CI: process.env.CI || false,
83+
ENABLE_COVERAGE: process.env.ENABLE_COVERAGE || false,
7784
},
7885
retries: {
7986
runMode: 2,

e2e/cypress/fixtures/cc-service-gwa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
- name: cc-service-for-platform
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.ccplatform]
55
port: 443
66
protocol: https

e2e/cypress/fixtures/cc-service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
- name: cc-service-for-platform
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.ccplatform]
55
port: 443
66
protocol: https

e2e/cypress/fixtures/org-service.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
- name: a-service-for-orgassignment
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.orgassignment]
55
port: 443
66
protocol: https

e2e/cypress/fixtures/service-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
- name: service-for-apiplatform
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.apiplatform]
55
port: 443
66
protocol: https

e2e/cypress/fixtures/service-availability.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
kind: GatewayService
22
name: taken-service-name
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.service-avail]
55
port: 446
66
protocol: https

e2e/cypress/fixtures/service-clear-resources-gwa.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
services:
22
- name: service-for-deleteplatform
3-
host: httpbin.org
3+
host: httpbun.com
44
tags: [ns.deleteplatform]
55
port: 443
66
protocol: https

0 commit comments

Comments
 (0)