@@ -9,6 +9,7 @@ TOOLSDIR := hack/tools
9
9
PATH := bin:$(TOOLSDIR ) /bin:$(PATH )
10
10
STACKER := $(shell which stacker)
11
11
GOLINTER := $(TOOLSDIR ) /bin/golangci-lint
12
+ NOTATION := $(TOOLSDIR ) /bin/notation
12
13
OS ?= linux
13
14
ARCH ?= amd64
14
15
@@ -40,9 +41,9 @@ exporter-minimal: swagger
40
41
env CGO_ENABLED=0 GOOS=$(OS ) GOARCH=$(ARCH ) go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter
41
42
42
43
.PHONY : test
43
- test :
44
+ test : check-skopeo $( NOTATION )
44
45
$(shell mkdir -p test/data; cd test/data; ../scripts/gen_certs.sh; cd ${TOP_LEVEL}; sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:7 oci:${TOP_LEVEL}/test/data/zot-test:0.0.1;sudo skopeo --insecure-policy copy -q docker://public.ecr.aws/t0x7q1g8/centos:8 oci:${TOP_LEVEL}/test/data/zot-cve-test:0.0.1)
45
- $(shell sudo mkdir -p /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/client.* /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/ca.* /etc/containers/certs.d/127.0.0.1:8089/;)
46
+ $(shell sudo mkdir -p /etc/containers/certs.d/127.0.0.1:8089/; sudo cp test/data/client.* test/data/ca.* /etc/containers/certs.d/127.0.0.1:8089/;)
46
47
$(shell sudo chmod a=rwx /etc/containers/certs.d/127.0.0.1:8089/* .key)
47
48
go test -tags extended,containers_image_openpgp -v -trimpath -race -timeout 15m -cover -coverpkg ./... -coverprofile=coverage-extended.txt -covermode=atomic ./...
48
49
go test -tags minimal,containers_image_openpgp -v -trimpath -race -cover -coverpkg ./... -coverprofile=coverage-minimal.txt -covermode=atomic ./...
51
52
test-clean :
52
53
$(shell sudo rm -rf /etc/containers/certs.d/127.0.0.1:8089/)
53
54
55
+ .PHONY : check-skopeo
56
+ check-skopeo :
57
+ skopeo -v || (echo " You need skopeo to be installed in order to run tests" ; exit 1)
58
+
59
+ $(NOTATION ) :
60
+ mkdir -p $(TOOLSDIR ) /bin
61
+ curl -Lo notation.tar.gz https://github.com/notaryproject/notation/releases/download/v0.7.1-alpha.1/notation_0.7.1-alpha.1_linux_amd64.tar.gz
62
+ tar xvzf notation.tar.gz -C $(TOOLSDIR ) /bin notation
63
+ rm notation.tar.gz
64
+
54
65
.PHONY : covhtml
55
66
covhtml :
56
67
tail -n +2 coverage-minimal.txt > tmp.txt && mv tmp.txt coverage-minimal.txt
0 commit comments