first acceptance test

This commit is contained in:
Yann Hamon 2020-06-02 00:16:38 +02:00
parent cee6971ee9
commit 0eecf37d9b
3 changed files with 29 additions and 1 deletions

View file

@ -1,6 +1,6 @@
#!/usr/bin/make -f
.PHONY: test-build test build build-static docker-test docker-build-static
.PHONY: test-build test build build-static docker-test docker-build-static acceptance
test-build: test build
@ -19,3 +19,5 @@ docker-test:
docker-build-static:
docker run -t -v $$PWD:/go/src/github.com/yannh/kubeconform -w /go/src/github.com/yannh/kubeconform golang:1.14 make build-static
acceptance:
bats acceptance.bats

7
acceptance.bats Normal file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env bats
@test "Pass when parsing a valid Kubernetes config YAML file" {
run bin/kubeconform -file fixtures/valid.yaml -summary
[ "$status" -eq 0 ]
[ "$output" = "Run summary - Valid: 1, Invalid: 0, Errors: 0 Skipped: 0" ]
}

19
fixtures/valid.yaml Executable file
View file

@ -0,0 +1,19 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: "bob"
spec:
replicas: 2
selector:
app: nginx
template:
metadata:
name: nginx
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80