Skip to content

Commit 68868fb

Browse files
committed
Migration III
The e2e tests now run inside docker. It spawns 3 containers: * Grafana * Checkmk * Playwright runner In order to run the tests, first you need to manually build the plugin > npm run build With the plugin built, the tests run unattended from docker tests > docker compose up --build
1 parent c99edd1 commit 68868fb

File tree

5 files changed

+71
-7
lines changed

5 files changed

+71
-7
lines changed

.gitignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ work/
2626
ci/
2727

2828
# e2e test directories
29-
/test-results/
30-
/playwright-report/
31-
/blob-report/
32-
/playwright/.cache/
33-
/playwright/.auth/
29+
tests/results/
30+
playwright-report/
31+
blob-report/
32+
playwright/.cache/
33+
playwright/.auth/
3434

3535
# Editor
3636
.idea

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"pretty": "prettier -w '{**/*,*}.{js,ts,jsx,tsx,json,yml}'",
1515
"server": "docker-compose up --build",
1616
"start": "npm run watch",
17-
"sign": "npx --yes @grafana/sign-plugin@latest",
17+
"sign": "npx --yes @grafana/sign-plugin@latest",
1818
"e2e": "playwright test",
19-
"e2e:ci": "npm run build && npm run e2e",
19+
"e2e:ci": "playwright test",
2020
"e2e:debug": "playwright test --debug"
2121
},
2222
"author": "Checkmk",

playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig, devices } from '@playwright/test';
33

44
export default defineConfig<PluginOptions>({
55
testDir: './tests/e2e/tests',
6+
outputDir: './tests/results',
67
fullyParallel: false,
78
forbidOnly: !!process.env.CI,
89
retries: process.env.CI ? 2 : 0,

tests/Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM mcr.microsoft.com/playwright:v1.46.1-jammy
2+
3+
WORKDIR /app
4+
5+
COPY . ./
6+
7+
RUN apt-get update && \
8+
apt-get install -y jq && \
9+
npm install && \
10+
npx playwright install --with-deps
11+
12+
ENTRYPOINT [ "npm", "run", "e2e:ci" ]

tests/docker-compose.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
services:
2+
checkmk:
3+
image: checkmk/check-mk-cloud:2.3.0-latest
4+
container_name: checkmk
5+
ports:
6+
- '12345:5000'
7+
volumes:
8+
- ./checkmk-docker-hooks:/docker-entrypoint.d
9+
10+
grafana:
11+
image: grafana/grafana-oss:latest
12+
container_name: grafana
13+
volumes:
14+
- ../dist:/var/lib/grafana/plugins/grafana-checkmk-datasource
15+
environment:
16+
GF_ANALYTICS_REPORTING_ENABLED: 'false'
17+
GF_ANALYTICS_CHECK_FOR_UPDATES: 'false'
18+
GF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES: 'false'
19+
GF_SECURITY_ADMIN_USER: admin
20+
GF_SECURITY_ADMIN_PASSWORD: password
21+
GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: tribe-29-checkmk-datasource
22+
extra_hosts:
23+
- checkmk.local:host-gateway
24+
ports:
25+
- '3003:3000'
26+
depends_on:
27+
- checkmk
28+
29+
playwright:
30+
build:
31+
context: ../
32+
dockerfile: tests/Dockerfile
33+
environment:
34+
CMK_SITE: cmk
35+
CMK_ADMIN: cmkadmin
36+
CMK_AUTOMATION: automation
37+
CMK_PASSWORD: abskjfdalkdhjbld
38+
PLAYWRIGHT_TO_CHECKMK_URL: http://checkmk:5000/cmk/
39+
GRAFANA_USER: admin
40+
GRAFANA_PASSWORD: password
41+
GRAFANA_URL: http://grafana:3000/
42+
GRAFANA_TO_CHECKMK_USER: automation
43+
GRAFANA_TO_CHECKMK_PASSWORD: abskjfdalkdhjbld
44+
GRAFANA_TO_CHECKMK_URL: http://checkmk:5000/cmk/
45+
extra_hosts:
46+
- checkmk.local:host-gateway
47+
volumes:
48+
- ./results:/app/tests/results
49+
depends_on:
50+
- grafana
51+
- checkmk

0 commit comments

Comments
 (0)