Skip to content

Commit

Permalink
Add more acceptance tests
Browse files Browse the repository at this point in the history
Tests functionality with the --schema-location flag, the
KUBEVAL_SCHEMA_LOCATION environment variable, and the --openshift flag
  • Loading branch information
ian-howell committed Jul 24, 2019
1 parent 70e32d6 commit cf88908
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions acceptance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]
}

0 comments on commit cf88908

Please sign in to comment.