Skip to content

Commit b131fb2

Browse files
committed
# This is a combination of 10 commits.
# This is the 1st commit message: Containerize tests - test cycle # This is the commit message #2: adapt working directory # This is the commit message #3: Build before running tests (so we might have a cache) # This is the commit message #4: Test limiting parallelism # This is the commit message #5: Remove unbound variable # This is the commit message #6: Decrease parallelism to find out limit # This is the commit message #7: Use correct flag # This is the commit message #8: Update Docker image # This is the commit message #9: Remove build phase and increase parallelism # This is the commit message #10: Further increase parallelism
1 parent ab80a81 commit b131fb2

File tree

4 files changed

+41
-15
lines changed

4 files changed

+41
-15
lines changed

.circleci/config.yml

+5-11
Original file line numberDiff line numberDiff line change
@@ -77,24 +77,18 @@ jobs:
7777
path: codegen.patch
7878
destination: .
7979
test:
80-
working_directory: /home/circleci/.go_workspace/src/github.com/argoproj/argo-cd
81-
machine:
82-
image: circleci/classic:201808-01
80+
working_directory: /go/src/github.com/argoproj/argo-cd
81+
docker:
82+
- image: jannfis/argocd-test-utils:0.0.3
8383
steps:
8484
- restore_go_cache
85-
- install_golang
8685
- checkout
8786
- restore_cache:
8887
key: test-dl-v2
89-
- run: sudo ./hack/install.sh kubectl-linux kubectx-linux dep-linux ksonnet-linux helm-linux helm2-linux kustomize-linux
90-
- save_cache:
91-
key: test-dl-v2
92-
paths: [/tmp/dl]
9388
- configure_git
94-
- run: go get github.com/jstemmer/go-junit-report
9589
- restore_vendor
9690
- run: dep ensure -v
97-
- run: make test
91+
- run: make test-local
9892
- save_vendor
9993
- save_go_cache
10094
- run:
@@ -214,4 +208,4 @@ workflows:
214208
- ui:
215209
requires:
216210
- codegen
217-
- e2e
211+
- e2e

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PACKR_CMD=$(shell if [ "`which packr`" ]; then echo "packr"; else echo "go run v
1212
VOLUME_MOUNT=$(shell if [[ selinuxenabled -eq 0 ]]; then echo ":Z"; elif [[ $(go env GOOS)=="darwin" ]]; then echo ":delegated"; else echo ""; fi)
1313

1414
define run-in-dev-tool
15-
docker run --rm -it -u $(shell id -u) -e HOME=/home/user -v ${CURRENT_DIR}:/go/src/github.com/argoproj/argo-cd${VOLUME_MOUNT} -w /go/src/github.com/argoproj/argo-cd argocd-dev-tools bash -c "GOPATH=/go $(1)"
15+
docker run --rm -it -u $(shell id -u) -e HOME=/home/user -v ${HOME}/go/src:/go/src${VOLUME_MOUNT} -w /go/src/github.com/argoproj/argo-cd argocd-dev-tools bash -c "GOPATH=/go $(1)"
1616
endef
1717

1818
PATH:=$(PATH):$(PWD)/hack
@@ -175,7 +175,11 @@ build:
175175
go build -v `go list ./... | grep -v 'resource_customizations\|test/e2e'`
176176

177177
.PHONY: test
178-
test:
178+
test: dev-tools-image
179+
$(call run-in-dev-tool,make test-local)
180+
181+
.PHONY: test-local
182+
test-local:
179183
./hack/test.sh -coverprofile=coverage.out `go list ./... | grep -v 'test/e2e'`
180184

181185
.PHONY: test-e2e

hack/Dockerfile.dev-tools

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
FROM golang:1.14.0 as builder
22

3-
RUN apt-get update && apt-get install -y zip
3+
RUN echo 'deb http://deb.debian.org/debian buster-backports main' >> /etc/apt/sources.list
4+
5+
RUN apt-get update && apt-get install -y \
6+
ca-certificates \
7+
openssh-server \
8+
nginx \
9+
fcgiwrap \
10+
git \
11+
git-lfs \
12+
gpg \
13+
make \
14+
wget \
15+
gcc \
16+
zip && \
17+
apt-get clean && \
18+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
19+
420

521
ADD install.sh .
622
ADD installers installers
723

24+
RUN ./install.sh dep-linux
25+
RUN ./install.sh packr-linux
26+
RUN ./install.sh kubectl-linux
27+
RUN ./install.sh ksonnet-linux
28+
RUN ./install.sh helm2-linux
29+
RUN ./install.sh helm-linux
30+
RUN ./install.sh kustomize-linux
31+
832
RUN ./install.sh codegen-tools
933
RUN ./install.sh codegen-go-tools
1034

1135
RUN mkdir -p /home/user && chmod 777 /home/user
1236
RUN HELM_HOME=/home/user/.helm helm2 init --client-only
1337

38+
RUN git config --system user.name "ArgoCD Test User"
39+
RUN git config --system user.email "noreply@example.com"
40+
1441
RUN mkdir -p /go/pkg && chmod 777 /go/pkg
1542

1643
RUN apt-get clean && \

hack/test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -eux -o pipefail
33

44
# make sure apiclient does not depend on packr
55
which godepgraph || go get github.com/kisielk/godepgraph
6+
which go-junit-report || go get github.com/jstemmer/go-junit-report
67
if godepgraph -s github.com/argoproj/argo-cd/pkg/apiclient | grep packr; then
78
echo apiclient package should not depend on packr
89
exit 1
@@ -20,4 +21,4 @@ report() {
2021

2122
trap 'report' EXIT
2223

23-
go test -failfast $* 2>&1 | tee $TEST_RESULTS/test.out
24+
go test -p 8 -failfast $* 2>&1 | tee $TEST_RESULTS/test.out

0 commit comments

Comments
 (0)