File tree Expand file tree Collapse file tree 7 files changed +435
-1
lines changed Expand file tree Collapse file tree 7 files changed +435
-1
lines changed Original file line number Diff line number Diff line change @@ -22,3 +22,4 @@ script:
2222 - echo "${TRAVIS_COMMIT_RANGE} -> ${TRAVIS_COMMIT_RANGE/.../..} (travis-ci/travis-ci#4596)"
2323 - TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make .gitvalidation
2424 - make docs
25+ - make -C schema test
Original file line number Diff line number Diff line change 1+ GOOD_TESTS = $(wildcard test/good/* .json)
2+ BAD_TESTS = $(wildcard test/bad/* .json)
13
24.PHONY : default
35default : validate
@@ -12,13 +14,42 @@ help:
1214
1315.PHONY : fmt
1416fmt :
15- for i in * .json ; do jq --indent 4 -M . " $$ {i} " > xx && cat xx > " $$ {i} " && rm xx ; done
17+ find . -name ' *.json' -exec bash -c ' jq --indent 4 -M . {} > xx && mv xx {} || echo "skipping invalid {}" ' \;
1618
1719.PHONY : validate
1820validate : validate.go
1921 go get -d ./...
2022 go build ./validate.go
2123
24+ .PHONY : test
25+ test : validate $(TESTS )
26+ for TYPE in $$ (ls test); \
27+ do \
28+ echo " testing $$ {TYPE}" ; \
29+ for FILE in $$ (ls " test/$$ {TYPE}/good" ); \
30+ do \
31+ echo " testing test/$$ {TYPE}/good/$$ {FILE}" ; \
32+ if ./validate " $$ {TYPE}-schema.json" " test/$$ {TYPE}/good/$$ {FILE}" ; \
33+ then \
34+ echo " received expected validation success" ; \
35+ else \
36+ echo " received unexpected validation failure" ; \
37+ exit 1; \
38+ fi \
39+ done ; \
40+ for FILE in $$ (ls " test/$$ {TYPE}/bad" ); \
41+ do \
42+ echo " testing test/$$ {TYPE}/bad/$$ {FILE}" ; \
43+ if ./validate " $$ {TYPE}-schema.json" " test/$$ {TYPE}/good/$$ {FILE}" ; \
44+ then \
45+ echo " received unexpected validation success" ; \
46+ exit 1; \
47+ else \
48+ echo " received expected validation failure" ; \
49+ fi \
50+ done ; \
51+ done
52+
2253.PHONY : clean
2354clean :
2455 rm -f validate
Original file line number Diff line number Diff line change 1+ {]
Original file line number Diff line number Diff line change 1+ {
2+ "ociVersion" : " 1.0.0" ,
3+ "platform" : {
4+ "os" : " linux" ,
5+ "arch" : " amd64"
6+ },
7+ "root" : {
8+ "path" : " rootfs"
9+ },
10+ "process" : {
11+ "cwd" : " /" ,
12+ "args" : [" sh" ],
13+ "user" : {
14+ "uid" : 0 ,
15+ "gid" : 0
16+ }
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments