Skip to content

Commit dd807f9

Browse files
authored
Merge pull request #3 from garethr/int-or-string-redux
Add test to demonstrate support for int-or-string
2 parents 8f1ddc1 + 026d880 commit dd807f9

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

acceptance.bats

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
[ "$output" = "The document fixtures/valid.json is a valid Deployment" ]
1313
}
1414

15+
@test "Pass when parsing a valid Kubernetes config file with int_to_string vars" {
16+
run kubeval fixtures/int_or_string.yaml
17+
[ "$status" -eq 0 ]
18+
[ "$output" = "The document fixtures/int_or_string.yaml is a valid Service" ]
19+
}
20+
1521
@test "Fail when parsing an invalid Kubernetes config file" {
1622
run kubeval fixtures/invalid.yaml
1723
[ "$status" -eq 1 ]
@@ -34,3 +40,4 @@
3440
[ "$status" -eq 1 ]
3541
[ $(expr "$output" : "^Missing a kind key") -ne 0 ]
3642
}
43+

cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func validate(element string) bool {
142142
normalisedVersion = "v" + normalisedVersion
143143
}
144144

145-
schema := fmt.Sprintf("https://raw.githubusercontent.com/garethr/%s-json-schema/master/%s/%s.json", schemaType, normalisedVersion, strings.ToLower(kind))
145+
schema := fmt.Sprintf("https://raw.githubusercontent.com/garethr/%s-json-schema/master/%s-standalone/%s.json", schemaType, normalisedVersion, strings.ToLower(kind))
146146

147147
schemaLoader := gojsonschema.NewReferenceLoader(schema)
148148

fixtures/int_or_string.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
task: monitoring
6+
# For use as a Cluster add-on (https://github.com/kubernetes/kubernetes/tree/master/cluster/addons)
7+
# If you are NOT using this as an addon, you should comment out this line.
8+
kubernetes.io/cluster-service: 'true'
9+
kubernetes.io/name: Heapster
10+
name: heapster
11+
namespace: kube-system
12+
spec:
13+
ports:
14+
- port: 80
15+
targetPort: 8082
16+
selector:
17+
k8s-app: heapster

0 commit comments

Comments
 (0)