Skip to content

Commit 44f5d62

Browse files
authored
test: migrate node unit tests to helm-unittest (#958)
1 parent af4641e commit 44f5d62

11 files changed

Lines changed: 128 additions & 492 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

helm/flowfuse/tests/configmap_test.yaml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,107 @@ templates:
55
set:
66
forge.domain: "chart-unit-tests.com"
77
tests:
8+
- it: should render core server settings (host, port, domain)
9+
set:
10+
forge.domain: example.com
11+
asserts:
12+
- matchRegex:
13+
path: data["flowforge.yml"]
14+
pattern: "host: 0\\.0\\.0\\.0"
15+
- matchRegex:
16+
path: data["flowforge.yml"]
17+
pattern: "port: 3000"
18+
- matchRegex:
19+
path: data["flowforge.yml"]
20+
pattern: "domain: example\\.com"
21+
22+
- it: should configure the postgres database
23+
asserts:
24+
- matchRegex:
25+
path: data["flowforge.yml"]
26+
pattern: "db:\\n\\s+type: postgres"
27+
28+
- it: should configure the kubernetes driver
29+
asserts:
30+
- matchRegex:
31+
path: data["flowforge.yml"]
32+
pattern: "driver:\\n\\s+type: kubernetes"
33+
34+
- it: should render default logging configuration
35+
asserts:
36+
- matchRegex:
37+
path: data["flowforge.yml"]
38+
pattern: "logging:\\n\\s+level: info\\n\\s+http: info"
39+
40+
- it: should render the email block when email is configured
41+
set:
42+
forge.email:
43+
from: '"FlowForge" <flowforge@example.com>'
44+
ses:
45+
region: eu-west-1
46+
asserts:
47+
- matchRegex:
48+
path: data["flowforge.yml"]
49+
pattern: "email:\\n\\s+enabled: true"
50+
51+
- it: should default the email block to disabled when email is not configured
52+
asserts:
53+
- matchRegex:
54+
path: data["flowforge.yml"]
55+
pattern: "email:\\n\\s+enabled: false"
56+
57+
- it: should render broker url and public_url when broker is enabled
58+
set:
59+
forge.broker:
60+
enabled: true
61+
url: mqtt://flowforge-broker.default:1883
62+
public_url: wss://mqtt.example.com
63+
asserts:
64+
- matchRegex:
65+
path: data["flowforge.yml"]
66+
pattern: "broker:"
67+
- matchRegex:
68+
path: data["flowforge.yml"]
69+
pattern: "url: mqtt://flowforge-broker\\.default:1883"
70+
- matchRegex:
71+
path: data["flowforge.yml"]
72+
pattern: "public_url: wss://mqtt\\.example\\.com"
73+
74+
- it: should render the fileStore url when fileStore is enabled
75+
release:
76+
namespace: default
77+
set:
78+
forge.fileStore.enabled: true
79+
asserts:
80+
- matchRegex:
81+
path: data["flowforge.yml"]
82+
pattern: "fileStore:\\n\\s+url: http://flowforge-file\\.default"
83+
84+
- it: should render sentry telemetry for frontend and backend
85+
set:
86+
forge.telemetry.sentry:
87+
production_mode: false
88+
frontend_dsn: https://sentry.io/flowforge/flowforge-frontend
89+
backend_dsn: https://sentry.io/flowforge/flowforge-backend
90+
asserts:
91+
- matchRegex:
92+
path: data["flowforge.yml"]
93+
pattern: "dsn: https://sentry\\.io/flowforge/flowforge-frontend"
94+
- matchRegex:
95+
path: data["flowforge.yml"]
96+
pattern: "dsn: https://sentry\\.io/flowforge/flowforge-backend"
97+
- matchRegex:
98+
path: data["flowforge.yml"]
99+
pattern: "production_mode: false"
100+
101+
- it: should render prometheus enabled in backend telemetry
102+
set:
103+
forge.telemetry.backend.prometheus.enabled: true
104+
asserts:
105+
- matchRegex:
106+
path: data["flowforge.yml"]
107+
pattern: "prometheus:\\n\\s+enabled: true"
108+
8109
- it: should not include projectProbes by default
9110
asserts:
10111
- notMatchRegex:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
2+
suite: test file storage configmap
3+
templates:
4+
- file-storage-configmap.yaml
5+
set:
6+
forge.domain: "chart-unit-tests.com"
7+
forge.fileStore.enabled: true
8+
tests:
9+
- it: should create the flowfuse-file-config configmap
10+
documentSelector:
11+
path: metadata.name
12+
value: flowfuse-file-config
13+
asserts:
14+
- isKind:
15+
of: ConfigMap
16+
- equal:
17+
path: metadata.name
18+
value: flowfuse-file-config
19+
20+
- it: should enable http logging in the file storage config
21+
documentSelector:
22+
path: metadata.name
23+
value: flowfuse-file-config
24+
asserts:
25+
- matchRegex:
26+
path: data["flowforge-storage.yml"]
27+
pattern: "logging:\\n\\s+level: info\\n\\s+http: info"

test/.eslintrc

Lines changed: 0 additions & 29 deletions
This file was deleted.

test/customizations-teambroker.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

test/customizations.yml

Lines changed: 0 additions & 79 deletions
This file was deleted.

test/package.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)