File tree Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Original file line number Diff line number Diff line change
1
+ FROM golang:1.12.9-alpine AS downloader
2
+
3
+ # git is required by 'go mod'
4
+ RUN apk add git
5
+
6
+ WORKDIR /app
7
+
8
+ COPY go.mod .
9
+ COPY go.sum .
10
+ # It is done only once unless go.mod has been changed
11
+ RUN go mod download
12
+
13
+ FROM downloader
14
+
15
+ COPY pkg /app/pkg
16
+ COPY dashboard /app/dashboard
17
+
18
+ ARG VERBOSE
19
+ RUN CGO_ENABLED=0 go test ${VERBOSE} \
20
+ ./pkg/apis/... \
21
+ ./pkg/backup/... \
22
+ ./pkg/deployment/... \
23
+ ./pkg/storage/... \
24
+ ./pkg/util/...
Original file line number Diff line number Diff line change @@ -109,9 +109,6 @@ ifeq ($(LONG), 1)
109
109
TESTLENGTHOPTIONS :=
110
110
TESTTIMEOUT := 300m
111
111
endif
112
- ifdef VERBOSE
113
- TESTVERBOSEOPTIONS := -v
114
- endif
115
112
116
113
SOURCES := $(shell find $(SRCDIR ) -name '* .go' -not -path './test/* ')
117
114
DASHBOARDSOURCES := $(shell find $(DASHBOARDDIR ) /src -name '* .js' -not -path './test/* ') $(DASHBOARDDIR ) /package.json
@@ -294,18 +291,11 @@ manifests: helm manifests-crd manifests-operator manifests-test chart-crd chart-
294
291
295
292
.PHONY : run-unit-tests
296
293
run-unit-tests : $(SOURCES )
297
- go test $(TESTVERBOSEOPTIONS ) \
298
- $(REPOPATH ) /pkg/apis/backup/v1alpha \
299
- $(REPOPATH ) /pkg/apis/deployment/v1alpha \
300
- $(REPOPATH ) /pkg/apis/replication/v1alpha \
301
- $(REPOPATH ) /pkg/apis/storage/v1alpha \
302
- $(REPOPATH ) /pkg/deployment/... \
303
- $(REPOPATH ) /pkg/storage \
304
- $(REPOPATH ) /pkg/util/k8sutil \
305
- $(REPOPATH ) /pkg/util/k8sutil/test \
306
- $(REPOPATH ) /pkg/util/probe \
307
- $(REPOPATH ) /pkg/util/validation \
308
- $(REPOPATH ) /pkg/backup/...
294
+ ifdef VERBOSE
295
+ docker build --build-arg VERBOSE=-v -f Dockerfile.unittest .
296
+ else
297
+ docker build -f Dockerfile.unittest .
298
+ endif
309
299
310
300
$(TESTBIN ) : $(GOBUILDDIR ) $(SOURCES )
311
301
@mkdir -p $(BINDIR )
You can’t perform that action at this time.
0 commit comments