diff --git a/acceptance.bats b/acceptance.bats index 12cab7a..7aa73b4 100755 --- a/acceptance.bats +++ b/acceptance.bats @@ -115,3 +115,43 @@ run bin/kubeval --ignore-missing-schemas fixtures/test_crd.yaml [ "$status" -eq 0 ] } + +@test "Pass when using a valid --schema-location" { + run bin/kubeval fixtures/valid.yaml --schema-location https://kubernetesjsonschema.dev + [ "$status" -eq 0 ] +} + +@test "Fail when using a faulty --schema-location" { + run bin/kubeval fixtures/valid.yaml --schema-location foo + [ "$status" -eq 1 ] +} + +@test "Pass when using a valid KUBEVAL_SCHEMA_LOCATION variable" { + KUBEVAL_SCHEMA_LOCATION=https://kubernetesjsonschema.dev run bin/kubeval fixtures/valid.yaml + [ "$status" -eq 0 ] +} + +@test "Fail when using a faulty KUBEVAL_SCHEMA_LOCATION variable" { + KUBEVAL_SCHEMA_LOCATION=foo run bin/kubeval fixtures/valid.yaml + [ "$status" -eq 1 ] +} + +@test "Pass when using a valid --schema-location, which overrides a faulty KUBEVAL_SCHEMA_LOCATION variable" { + KUBEVAL_SCHEMA_LOCATION=foo run bin/kubeval fixtures/valid.yaml --schema-location https://kubernetesjsonschema.dev + [ "$status" -eq 0 ] +} + +@test "Fail when using a faulty --schema-location, which overrides a valid KUBEVAL_SCHEMA_LOCATION variable" { + KUBEVAL_SCHEMA_LOCATION=https://kubernetesjsonschema.dev run bin/kubeval fixtures/valid.yaml --schema-location foo + [ "$status" -eq 1 ] +} + +@test "Pass when using --openshift with a valid input" { + run bin/kubeval fixtures/valid.yaml --openshift + [ "$status" -eq 0 ] +} + +@test "Fail when using --openshift with an invalid input" { + run bin/kubeval fixtures/invalid.yaml --openshift + [ "$status" -eq 1 ] +}