You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: scripts/acceptance.bats
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,42 @@ setup() {
5
5
rm -f prometheus-monitoring-v1.json
6
6
}
7
7
8
+
@test "Should generate expected prometheus resource while disable ssl env var is set" {
9
+
run export DISABLE_SSL_CERT_VALIDATION=true
10
+
run ./openapi2jsonschema.py fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml
11
+
[ "$status"-eq 0 ]
12
+
[ "$output"="JSON schema written to prometheus_v1.json" ]
13
+
run diff prometheus_v1.json ./fixtures/prometheus_v1-expected.json
14
+
[ "$status"-eq 0 ]
15
+
}
16
+
17
+
@test "Should generate expected prometheus resource from an HTTPS resource while disable ssl env var is set" {
18
+
run export DISABLE_SSL_CERT_VALIDATION=true
19
+
run ./openapi2jsonschema.py https://raw.githubusercontent.com/yannh/kubeconform/aebc298047c386116eeeda9b1ada83671a58aedd/scripts/fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml
20
+
[ "$status"-eq 0 ]
21
+
[ "$output"="JSON schema written to prometheus_v1.json" ]
22
+
run diff prometheus_v1.json ./fixtures/prometheus_v1-expected.json
23
+
[ "$status"-eq 0 ]
24
+
}
25
+
26
+
@test "Should output filename in {kind}-{group}-{version} format while disable ssl env var is set" {
27
+
run export DISABLE_SSL_CERT_VALIDATION=true
28
+
FILENAME_FORMAT='{kind}-{group}-{version}' run ./openapi2jsonschema.py fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml
29
+
[ "$status"-eq 0 ]
30
+
[ "$output"="JSON schema written to prometheus-monitoring-v1.json" ]
31
+
run diff prometheus-monitoring-v1.json ./fixtures/prometheus_v1-expected.json
32
+
[ "$status"-eq 0 ]
33
+
}
34
+
35
+
@test "Should set 'additionalProperties: false' at the root while disable ssl env var is set" {
36
+
run export DISABLE_SSL_CERT_VALIDATION=true
37
+
DENY_ROOT_ADDITIONAL_PROPERTIES='true' run ./openapi2jsonschema.py fixtures/prometheus-operator-0prometheusCustomResourceDefinition.yaml
38
+
[ "$status"-eq 0 ]
39
+
[ "$output"="JSON schema written to prometheus_v1.json" ]
40
+
run diff prometheus_v1.json ./fixtures/prometheus_v1-denyRootAdditionalProperties.json
0 commit comments