mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 05:59:22 +00:00
more acceptance tests
This commit is contained in:
parent
51732e6a21
commit
9dda2ff599
3 changed files with 27 additions and 2 deletions
|
|
@ -64,6 +64,12 @@
|
|||
[ "$output" = "Summary: 0 resource found in 1 file - Valid: 0, Invalid: 0, Errors: 0 Skipped: 0" ]
|
||||
}
|
||||
|
||||
@test "Pass when parsing a blank config file with a comment" {
|
||||
run bin/kubeconform -summary fixtures/comment.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "Summary: 0 resource found in 1 file - Valid: 0, Invalid: 0, Errors: 0 Skipped: 0" ]
|
||||
}
|
||||
|
||||
@test "Fail when parsing a config with additional properties and strict set" {
|
||||
run bin/kubeconform -strict -k8sversion 1.16.0 fixtures/extra_property.yaml
|
||||
[ "$status" -eq 1 ]
|
||||
|
|
@ -83,3 +89,19 @@
|
|||
run bin/kubeconform -registry './fixtures/registry/{{ .ResourceKind }}{{ .KindSuffix }}.json' fixtures/test_crd.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "Pass when parsing a config with additional properties" {
|
||||
run bin/kubeconform -summary fixtures/extra_property.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
[ "$output" = "Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0 Skipped: 0" ]
|
||||
}
|
||||
|
||||
@test "Pass when using a valid, preset --registry" {
|
||||
run bin/kubeconform --registry kubernetesjsonschema.dev fixtures/valid.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
||||
@test "Pass when using a valid HTTP --registry" {
|
||||
run bin/kubeconform --registry 'https://kubernetesjsonschema.dev/{{ .NormalizedVersion }}-standalone{{ .StrictSuffix }}/{{ .ResourceKind }}{{ .KindSuffix }}.json' fixtures/valid.yaml
|
||||
[ "$status" -eq 0 ]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: nginx-ds
|
||||
spec:
|
||||
replicas: 2
|
||||
selector:
|
||||
matchLabels:
|
||||
k8s-app: nginx-ds
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ func (o *text) Write(filename, kind, name, version string, reserr error, skipped
|
|||
_, err = fmt.Fprintf(o.w, "%s - %s %s skipped\n", filename, name, kind)
|
||||
}
|
||||
o.nSkipped++
|
||||
case EMPTY:
|
||||
case EMPTY: // sent to ensure we count the filename as parsed
|
||||
}
|
||||
|
||||
return err
|
||||
|
|
|
|||
Loading…
Reference in a new issue