Skip to content

Commit

Permalink
Add acceptance tests for duplicated properties
Browse files Browse the repository at this point in the history
  • Loading branch information
bilbof committed Jul 15, 2022
1 parent 78ed040 commit 937f6f4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
10 changes: 10 additions & 0 deletions acceptance.bats
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,16 @@ resetCacheFolder() {
[ "$status" -eq 1 ]
}

@test "Fail when parsing a config with duplicate properties and strict set" {
run bin/kubeconform -strict -kubernetes-version 1.16.0 fixtures/duplicate_property.yaml
[ "$status" -eq 1 ]
}

@test "Pass when parsing a config with duplicate properties and strict NOT set" {
run bin/kubeconform -kubernetes-version 1.16.0 fixtures/duplicate_property.yaml
[ "$status" -eq 0 ]
}

@test "Pass when using a valid, preset -schema-location" {
run bin/kubeconform -schema-location default fixtures/valid.yaml
[ "$status" -eq 0 ]
Expand Down
18 changes: 18 additions & 0 deletions fixtures/duplicate_property.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nginx-ds
spec:
replicas: 2
selector:
matchLabels:
k8s-app: nginx-ds
template:
spec:
containers:
- image: envoy
name: envoy
containers:
- image: nginx
name: nginx

0 comments on commit 937f6f4

Please sign in to comment.