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:
22
22
- echo "${TRAVIS_COMMIT_RANGE} -> ${TRAVIS_COMMIT_RANGE/.../..} (travis-ci/travis-ci#4596)"
23
23
- TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE/.../..}" make .gitvalidation
24
24
- 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)
1
3
2
4
.PHONY : default
3
5
default : validate
@@ -12,13 +14,42 @@ help:
12
14
13
15
.PHONY : fmt
14
16
fmt :
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 {}" ' \;
16
18
17
19
.PHONY : validate
18
20
validate : validate.go
19
21
go get -d ./...
20
22
go build ./validate.go
21
23
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
+
22
53
.PHONY : clean
23
54
clean :
24
55
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