Skip to content

Commit 4733546

Browse files
committed
tests: Check schema validation output
It should mention the faulty path as well as the faulty content
1 parent 5db0775 commit 4733546

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/unit/validate.bats.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ functions:
3737
validate_schema: |-
3838
env.init "${@}"
3939
40-
run yq_set 'sc' '.global.ck8sVersion' 'false'
41-
run ck8s validate sc <<< $'y\n'
42-
assert_failure
40+
run ck8s validate wc <<< $'y\n'
41+
assert_success
42+
43+
run yq_set 'wc' '.global.baseDomain' '"this is not a valid hostname"'
44+
run ck8s validate wc <<< $'y\n'
45+
assert_output --partial 'global.baseDomain'
4346
44-
run yq_set 'wc' '.global.ck8sCloudProvider' '"made-up-non-existant-provider"'
47+
run yq_set 'wc' '.global.baseDomain' '"this is not a valid hostname"'
4548
run ck8s validate wc <<< $'y\n'
46-
assert_failure
49+
assert_output --partial '"this is not a valid hostname"'
4750
4851
4952
validate_template: |-

0 commit comments

Comments
 (0)