1
0
Fork 0
mirror of https://github.com/arangodb/kube-arangodb.git synced 2024-12-14 11:57:37 +00:00

Docerize unit tests (#472)

* Docerize unit tests

* Improve unit tests
This commit is contained in:
informalict 2019-10-15 09:19:50 +02:00 committed by GitHub
parent 19cbd8dc5f
commit 17f63e8339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 15 deletions

24
Dockerfile.unittest Normal file
View file

@ -0,0 +1,24 @@
FROM golang:1.12.9-alpine AS downloader
# git is required by 'go mod'
RUN apk add git
WORKDIR /app
COPY go.mod .
COPY go.sum .
# It is done only once unless go.mod has been changed
RUN go mod download
FROM downloader
COPY pkg /app/pkg
COPY dashboard /app/dashboard
ARG VERBOSE
RUN CGO_ENABLED=0 go test ${VERBOSE} \
./pkg/apis/... \
./pkg/backup/... \
./pkg/deployment/... \
./pkg/storage/... \
./pkg/util/...

View file

@ -109,9 +109,6 @@ ifeq ($(LONG), 1)
TESTLENGTHOPTIONS :=
TESTTIMEOUT := 300m
endif
ifdef VERBOSE
TESTVERBOSEOPTIONS := -v
endif
SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
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-
.PHONY: run-unit-tests
run-unit-tests: $(SOURCES)
go test $(TESTVERBOSEOPTIONS) \
$(REPOPATH)/pkg/apis/backup/v1alpha \
$(REPOPATH)/pkg/apis/deployment/v1alpha \
$(REPOPATH)/pkg/apis/replication/v1alpha \
$(REPOPATH)/pkg/apis/storage/v1alpha \
$(REPOPATH)/pkg/deployment/... \
$(REPOPATH)/pkg/storage \
$(REPOPATH)/pkg/util/k8sutil \
$(REPOPATH)/pkg/util/k8sutil/test \
$(REPOPATH)/pkg/util/probe \
$(REPOPATH)/pkg/util/validation \
$(REPOPATH)/pkg/backup/...
ifdef VERBOSE
docker build --build-arg VERBOSE=-v -f Dockerfile.unittest .
else
docker build -f Dockerfile.unittest .
endif
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
@mkdir -p $(BINDIR)