Skip to content

Commit ebbf69c

Browse files
Fix running feature specs in docker
The serve:test command was broken, because it used an unsupported command-line option. Thus the frontend container would not start at all, thus breaking asset delivery during tests. A healthcheck was introduced as well, so that a non starting frontend container is easier to spot going forward.
1 parent 6daa17f commit ebbf69c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

docker-compose.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ services:
127127
frontend-test:
128128
build:
129129
<<: *frontend-build
130-
command: "npm run serve:test"
130+
command: "npm run serve"
131131
volumes:
132132
- ".:/home/dev/openproject"
133133
- "fedata-test:/home/dev/openproject/public/assets/frontend"
@@ -138,6 +138,8 @@ services:
138138
FE_HOST: frontend-test
139139
networks:
140140
- testing
141+
healthcheck:
142+
test: ["CMD", "curl", "-f", "http://frontend-test:4200/"]
141143

142144
backend-test:
143145
build:
@@ -148,10 +150,14 @@ services:
148150
networks:
149151
- testing
150152
depends_on:
151-
- db-test
152-
- selenium-hub
153-
- frontend-test
154-
- cuprite-chrome
153+
db-test:
154+
condition: service_started
155+
selenium-hub:
156+
condition: service_started
157+
frontend-test:
158+
condition: service_healthy
159+
cuprite-chrome:
160+
condition: service_started
155161
environment:
156162
RAILS_ENV: test
157163
OPENPROJECT_RAILS__RELATIVE__URL__ROOT: "${OPENPROJECT_RAILS__RELATIVE__URL__ROOT:-}"

frontend/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@
186186
"ci:plugins:register_frontend": "node ci-plugins-generator.js",
187187
"tokens:generate": "theo src/app/spot/styles/tokens/tokens.yml --transform web --format sass,json --dest src/app/spot/styles/tokens/dist",
188188
"serve": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve --host ${FE_HOST:-localhost} --port ${FE_PORT:-4200}",
189-
"serve:test": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng serve --host ${FE_HOST:-localhost} --port ${FE_PORT:-4200} --disable-host-check",
190189
"test": "ng test --watch=false",
191190
"test:watch": "ng test --watch=true",
192191
"lint": "ng lint",

0 commit comments

Comments
 (0)