mirror of
https://github.com/arangodb/kube-arangodb.git
synced 2024-12-14 11:57:37 +00:00
Tests/docerize integration tests (#473)
* Docerize integration tests * Change comment * Discard unnecessary changes
This commit is contained in:
parent
17f63e8339
commit
82cd2b0f4d
3 changed files with 41 additions and 19 deletions
|
@ -1,5 +0,0 @@
|
|||
FROM scratch
|
||||
|
||||
ADD bin/arangodb_operator_test /usr/bin/
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/arangodb_operator_test" ]
|
18
Makefile
18
Makefile
|
@ -24,10 +24,6 @@ GOPATH := $(GOBUILDDIR)
|
|||
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
|
||||
GOASSETSBUILDER := $(GOBUILDDIR)/bin/go-assets-builder$(shell go env GOEXE)
|
||||
|
||||
DOCKERFILE := Dockerfile
|
||||
DOCKERTESTFILE := Dockerfile.test
|
||||
DOCKERDURATIONTESTFILE := tests/duration/Dockerfile
|
||||
|
||||
HELM ?= $(shell which helm)
|
||||
|
||||
.PHONY: helm
|
||||
|
@ -96,8 +92,6 @@ ifndef ALLOWCHAOS
|
|||
ALLOWCHAOS := true
|
||||
endif
|
||||
|
||||
TESTBINNAME := $(PROJECT)_test
|
||||
TESTBIN := $(BINDIR)/$(TESTBINNAME)
|
||||
DURATIONTESTBINNAME := $(PROJECT)_duration_test
|
||||
DURATIONTESTBIN := $(BINDIR)/$(DURATIONTESTBINNAME)
|
||||
RELEASE := $(GOBUILDDIR)/bin/release
|
||||
|
@ -204,7 +198,7 @@ dashboard/assets.go: $(DASHBOARDSOURCES) $(DASHBOARDDIR)/Dockerfile.build
|
|||
|
||||
.PHONY: docker
|
||||
docker: check-vars $(SOURCES) dashboard/assets.go VERSION
|
||||
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) -f $(DOCKERFILE) -t $(OPERATORIMAGE) .
|
||||
docker build --build-arg VERSION=$(VERSION) --build-arg COMMIT=$(COMMIT) -f Dockerfile -t $(OPERATORIMAGE) .
|
||||
ifdef PUSHIMAGES
|
||||
docker push $(OPERATORIMAGE)
|
||||
endif
|
||||
|
@ -297,14 +291,10 @@ else
|
|||
docker build -f Dockerfile.unittest .
|
||||
endif
|
||||
|
||||
$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
|
||||
@mkdir -p $(BINDIR)
|
||||
CGO_ENABLED=0 go test -c -installsuffix netgo -ldflags "-X main.projectVersion=$(VERSION) -X main.projectBuild=$(COMMIT)" -o $(TESTBIN) $(REPOPATH)/tests
|
||||
|
||||
|
||||
.PHONY: docker-test
|
||||
docker-test: $(TESTBIN)
|
||||
docker build --quiet -f $(DOCKERTESTFILE) -t $(TESTIMAGE) .
|
||||
docker-test: check-vars $(GOBUILDDIR) $(SOURCES)
|
||||
docker build --quiet -f tests/Dockerfile -t $(TESTIMAGE) .
|
||||
|
||||
.PHONY: run-upgrade-tests
|
||||
run-upgrade-tests:
|
||||
|
@ -356,7 +346,7 @@ $(DURATIONTESTBIN): $(SOURCES)
|
|||
|
||||
.PHONY: docker-duration-test
|
||||
docker-duration-test: $(DURATIONTESTBIN)
|
||||
docker build --quiet -f $(DOCKERDURATIONTESTFILE) -t $(DURATIONTESTIMAGE) .
|
||||
docker build --quiet -f tests/duration/Dockerfile -t $(DURATIONTESTIMAGE) .
|
||||
ifdef PUSHIMAGES
|
||||
docker push $(DURATIONTESTIMAGE)
|
||||
endif
|
||||
|
|
37
tests/Dockerfile
Normal file
37
tests/Dockerfile
Normal file
|
@ -0,0 +1,37 @@
|
|||
# Download packages required by kube-arangodb
|
||||
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
|
||||
|
||||
|
||||
|
||||
# Compile Golang integration tests for kube-arangodb sources with downloaded dependencies
|
||||
FROM downloader AS builder
|
||||
|
||||
COPY tests /app/tests
|
||||
COPY pkg /app/pkg
|
||||
COPY dashboard/assets.go /app/dashboard/assets.go
|
||||
|
||||
ENV GO111MODULE=on
|
||||
ENV CGO_ENABLED=0
|
||||
ENV GOARCH=amd64
|
||||
ENV GOOS=linux
|
||||
|
||||
RUN go test -c -installsuffix netgo -o /arangodb_operator_test /app/tests
|
||||
|
||||
|
||||
|
||||
# Build the final integration test image with only binary file
|
||||
FROM scratch
|
||||
|
||||
COPY --from=builder /arangodb_operator_test /usr/bin/arangodb_operator
|
||||
|
||||
ENTRYPOINT [ "/usr/bin/arangodb_operator_test" ]
|
Loading…
Reference in a new issue