Skip to content

Commit cf88908

Browse files
committed
Add more acceptance tests
Tests functionality with the --schema-location flag, the KUBEVAL_SCHEMA_LOCATION environment variable, and the --openshift flag
1 parent 70e32d6 commit cf88908

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

acceptance.bats

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,43 @@
115115
run bin/kubeval --ignore-missing-schemas fixtures/test_crd.yaml
116116
[ "$status" -eq 0 ]
117117
}
118+
119+
@test "Pass when using a valid --schema-location" {
120+
run bin/kubeval fixtures/valid.yaml --schema-location https://kubernetesjsonschema.dev
121+
[ "$status" -eq 0 ]
122+
}
123+
124+
@test "Fail when using a faulty --schema-location" {
125+
run bin/kubeval fixtures/valid.yaml --schema-location foo
126+
[ "$status" -eq 1 ]
127+
}
128+
129+
@test "Pass when using a valid KUBEVAL_SCHEMA_LOCATION variable" {
130+
KUBEVAL_SCHEMA_LOCATION=https://kubernetesjsonschema.dev run bin/kubeval fixtures/valid.yaml
131+
[ "$status" -eq 0 ]
132+
}
133+
134+
@test "Fail when using a faulty KUBEVAL_SCHEMA_LOCATION variable" {
135+
KUBEVAL_SCHEMA_LOCATION=foo run bin/kubeval fixtures/valid.yaml
136+
[ "$status" -eq 1 ]
137+
}
138+
139+
@test "Pass when using a valid --schema-location, which overrides a faulty KUBEVAL_SCHEMA_LOCATION variable" {
140+
KUBEVAL_SCHEMA_LOCATION=foo run bin/kubeval fixtures/valid.yaml --schema-location https://kubernetesjsonschema.dev
141+
[ "$status" -eq 0 ]
142+
}
143+
144+
@test "Fail when using a faulty --schema-location, which overrides a valid KUBEVAL_SCHEMA_LOCATION variable" {
145+
KUBEVAL_SCHEMA_LOCATION=https://kubernetesjsonschema.dev run bin/kubeval fixtures/valid.yaml --schema-location foo
146+
[ "$status" -eq 1 ]
147+
}
148+
149+
@test "Pass when using --openshift with a valid input" {
150+
run bin/kubeval fixtures/valid.yaml --openshift
151+
[ "$status" -eq 0 ]
152+
}
153+
154+
@test "Fail when using --openshift with an invalid input" {
155+
run bin/kubeval fixtures/invalid.yaml --openshift
156+
[ "$status" -eq 1 ]
157+
}

0 commit comments

Comments
 (0)