Update acceptance tests

This commit is contained in:
Yann Hamon 2023-11-18 18:06:06 +01:00
parent 781246882e
commit e46a359dc8
2 changed files with 35 additions and 47 deletions

View file

@ -36,7 +36,7 @@ resetCacheFolder() {
} }
@test "Pass when parsing a valid Kubernetes config JSON file" { @test "Pass when parsing a valid Kubernetes config JSON file" {
run bin/kubeconform -kubernetes-version 1.17.1 -summary fixtures/valid.json run bin/kubeconform -kubernetes-version 1.20.0 -summary fixtures/valid.json
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
[ "$output" = "Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0" ] [ "$output" = "Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0" ]
} }
@ -134,17 +134,17 @@ resetCacheFolder() {
} }
@test "Fail when parsing a config with additional properties and strict set" { @test "Fail when parsing a config with additional properties and strict set" {
run bin/kubeconform -strict -kubernetes-version 1.16.0 fixtures/extra_property.yaml run bin/kubeconform -strict -kubernetes-version 1.20.0 fixtures/extra_property.yaml
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
} }
@test "Fail when parsing a config with duplicate properties and strict set" { @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 run bin/kubeconform -strict -kubernetes-version 1.20.0 fixtures/duplicate_property.yaml
[ "$status" -eq 1 ] [ "$status" -eq 1 ]
} }
@test "Pass when parsing a config with duplicate properties and strict NOT set" { @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 run bin/kubeconform -kubernetes-version 1.20.0 fixtures/duplicate_property.yaml
[ "$status" -eq 0 ] [ "$status" -eq 0 ]
} }

View file

@ -1,46 +1,34 @@
{ {
"apiVersion": "apps/v1beta1", "apiVersion": "v1",
"kind": "Deployment", "kind": "ReplicationController",
"metadata": { "metadata": {
"name": "nginx-deployment", "name": "bob"
"namespace": "default" },
}, "spec": {
"spec": { "replicas": 2,
"replicas": 2, "selector": {
"template": { "app": "nginx"
"spec": { },
"affinity": { }, "template": {
"containers": [ "metadata": {
{ "name": "nginx",
"args": [ ], "labels": {
"command": [ ], "app": "nginx"
"env": [ ], }
"envFrom": [ ], },
"image": "nginx:1.7.9", "spec": {
"lifecycle": { }, "containers": [
"livenessProbe": { }, {
"name": "nginx", "name": "nginx",
"ports": [ "image": "nginx",
{ "ports": [
"containerPort": 80, {
"name": "http" "containerPort": 80
} }
], ]
"readinessProbe": { }, }
"resources": { }, ]
"securityContext": { },
"volumeMounts": [ ]
}
],
"hostMappings": [ ],
"imagePullSecrets": [ ],
"initContainers": [ ],
"nodeSelector": { },
"securityContext": { },
"tolerations": [ ],
"volumes": [ ]
}
} }
}, }
"status": { } }
} }