Skip to content

Commit 3ff621b

Browse files
committed
ktl-744 chore: rework e2e tests env due to networking problems
1 parent 76cf932 commit 3ff621b

File tree

8 files changed

+31
-29
lines changed

8 files changed

+31
-29
lines changed

docker-compose.yml

-13
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,3 @@ services:
1212
- ./:/var/www
1313
environment:
1414
- PYTHONUNBUFFERED=1
15-
e2e-tests:
16-
build:
17-
dockerfile: dockerfiles/e2e-tests/Dockerfile
18-
context: .
19-
volumes:
20-
- ./:/var/www
21-
working_dir: /var/www
22-
environment:
23-
- BASE_URL=http://app:8080
24-
- ipc=host
25-
depends_on:
26-
- app
27-

dockerfiles/e2e-tests/Dockerfile

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
FROM mcr.microsoft.com/playwright:v1.22.2-focal
22

3+
RUN apt-get update
4+
RUN apt-get -y install python3.8 python3-pip git ruby-dev
5+
6+
RUN gem install kramdown -v 1.14.0
7+
38
WORKDIR /var/www
49

5-
COPY package.json yarn.lock ./
10+
COPY requirements.txt ./
11+
RUN pip install -r requirements.txt
612

13+
COPY package.json yarn.lock ./
714
RUN yarn install --frozen-lockfile
815

916
COPY playwright.config.js .
10-
COPY test test
17+
COPY . .
18+
19+
RUN yarn build
20+
21+
EXPOSE 8080
1122

12-
ENTRYPOINT ["tail", "-f", "/dev/null"]
23+
ENTRYPOINT ["python3.8", "kotlin-website.py"]

playwright.config.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const config = {
88
use: {
99
baseURL: process.env.BASE_URL || 'http://localhost:9000',
1010
trace: 'off',
11+
ignoreHTTPSErrors: true,
1112
},
1213
projects: [
1314
{
@@ -16,12 +17,6 @@ const config = {
1617
...devices['Desktop Chrome'],
1718
},
1819
},
19-
{
20-
name: 'webkit',
21-
use: {
22-
...devices['iPhone SE'],
23-
},
24-
}
2520
],
2621
};
2722

scripts/test/run-e2e.sh

-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ echo "Waiting for the $BASE_URL response"
88

99
./scripts/test/wait-for-endpoint.sh "$BASE_URL"
1010

11-
echo "The connection established"
12-
1311
yarn run test:e2e:ci

scripts/test/run.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
set -e
33
set +x
44
set -o pipefail
5+
set -u
56

67
cd "$(pwd)" || exit 1
78

8-
APP_CONTAINER_NAME="$(docker ps --format "{{.Names}}" --filter="name=_e2e-tests_")"
9+
APP_CONTAINER_NAME="kotlin-web-site_test-app"
910

1011
docker exec -i "$APP_CONTAINER_NAME" /bin/bash -c "./scripts/test/run-e2e.sh"

scripts/test/stop.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
set -e
33
set +x
44
set -o pipefail
5+
set -u
56

6-
docker-compose stop
7+
APP_CONTAINER_NAME="kotlin-web-site_test-app"
8+
9+
docker stop "$APP_CONTAINER_NAME"
10+
docker rm "$APP_CONTAINER_NAME"

scripts/test/up.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33
set +x
44
set -o pipefail
5+
set -u
56

6-
docker-compose up -d --build
7+
cd "$(pwd)" || exit 1
8+
9+
APP_CONTAINER_NAME="kotlin-web-site_test-app"
10+
11+
docker build -t "$APP_CONTAINER_NAME" -f ./dockerfiles/e2e-tests/Dockerfile .
12+
13+
docker run -d -p 8080:8080 -e BASE_URL=http://localhost:8080 -e ipc=host --name "$APP_CONTAINER_NAME" "$APP_CONTAINER_NAME"

scripts/test/wait-for-endpoint.sh

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# Waits until request to given URI returns 200 or timeout threshold is reached.
44
# Can be given a command to run when done waiting.
55
#
6-
76
SCRIPT_NAME=${0##*/}
87

98
echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }

0 commit comments

Comments
 (0)