Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 376c15d

Browse files
author
Ian Campbell
committed
ci: segregate experimental test junit files
... and record them. I'm unsure if previously the two stages could run on the same node in parallel and interfere with each other, this certainly avoids that. Signed-off-by: Ian Campbell <ijc@docker.com>
1 parent 01bfa14 commit 376c15d

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

Jenkinsfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,16 @@ pipeline {
144144
sh 'docker load -i coverage-experimental-invocation-image.tar'
145145
}
146146
ansiColor('xterm') {
147-
sh 'make EXPERIMENTAL=on -f docker.Makefile BUILD_TAG=$BUILD_TAG-coverage-experimental coverage'
147+
sh 'make EXPERIMENTAL=on TEST_RESULTS_PREFIX="experimental-" -f docker.Makefile BUILD_TAG=$BUILD_TAG-coverage-experimental coverage'
148148
}
149149
}
150150
}
151151
post {
152152
always {
153+
sh 'sed -i -E -e \'s,"github.com/docker/app","unit/experimental",g; s,"github.com/docker/app/([^"]*)","unit/experimental/\\1",g\' src/github.com/docker/app/_build/test-results/experimental-unit-coverage.xml'
154+
sh 'sed -i -E -e \'s,"github.com/docker/app/e2e","e2e/experimental",g\' src/github.com/docker/app/_build/test-results/experimental-e2e-coverage.xml'
155+
archiveArtifacts 'src/github.com/docker/app/_build/test-results/*.xml'
156+
junit 'src/github.com/docker/app/_build/test-results/*.xml'
153157
sh 'docker rmi docker/cnab-app-base:$BUILD_TAG-coverage-experimental'
154158
deleteDir()
155159
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ TEST_RESULTS_DIR = _build/test-results
2828
STATIC_FLAGS= CGO_ENABLED=0
2929
GO_BUILD = $(STATIC_FLAGS) go build -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
3030
GO_TEST = $(STATIC_FLAGS) go test -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
31-
GO_TESTSUM = $(STATIC_FLAGS) gotestsum --junitfile $(TEST_RESULTS_DIR)/$(1) -- -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
31+
GO_TESTSUM = $(STATIC_FLAGS) gotestsum --junitfile $(TEST_RESULTS_DIR)/$(TEST_RESULTS_PREFIX)$(1) -- -tags=$(BUILDTAGS) -ldflags=$(LDFLAGS)
3232

3333
all: bin/$(BIN_NAME) test
3434

docker.Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ test: test-unit test-e2e ## run all tests
9797

9898
test-unit: build_dev_image ## run unit tests
9999
@$(call mkdir,_build/test-results)
100-
docker run --rm -v $(CURDIR)/_build/test-results:/test-results $(DEV_IMAGE_NAME) make EXPERIMENTAL=$(EXPERIMENTAL) test-unit
100+
docker run --rm -v $(CURDIR)/_build/test-results:/test-results $(DEV_IMAGE_NAME) make EXPERIMENTAL=$(EXPERIMENTAL) TEST_RESULTS_PREFIX=$(TEST_RESULTS_PREFIX) test-unit
101101

102102
test-e2e: build_dev_image invocation-image ## run end-to-end tests
103-
docker run -v /var/run:/var/run:ro --rm --network="host" $(DEV_IMAGE_NAME) make EXPERIMENTAL=$(EXPERIMENTAL) bin/$(BIN_NAME) test-e2e
103+
docker run -v /var/run:/var/run:ro --rm --network="host" $(DEV_IMAGE_NAME) make EXPERIMENTAL=$(EXPERIMENTAL) TEST_RESULTS_PREFIX=$(TEST_RESULTS_PREFIX) bin/$(BIN_NAME) test-e2e
104104

105105
COV_LABEL := com.docker.app.cov-run=$(TAG)
106106
coverage: build_dev_image ## run tests with coverage
107107
@$(call mkdir,_build)
108-
docker run -v /var/run:/var/run:ro --name $(COV_CTNR_NAME) --network="host" -t $(DEV_IMAGE_NAME) make COMMIT=${COMMIT} TAG=${TAG} EXPERIMENTAL=$(EXPERIMENTAL) coverage
108+
docker run -v /var/run:/var/run:ro --name $(COV_CTNR_NAME) --network="host" -t $(DEV_IMAGE_NAME) make COMMIT=${COMMIT} TAG=${TAG} EXPERIMENTAL=$(EXPERIMENTAL) TEST_RESULTS_PREFIX=$(TEST_RESULTS_PREFIX) coverage
109109
docker cp $(COV_CTNR_NAME):$(PKG_PATH)/_build/cov/ ./_build/ci-cov
110110
docker cp $(COV_CTNR_NAME):$(PKG_PATH)/_build/test-results/ ./_build/test-results
111111
docker rm $(COV_CTNR_NAME)

0 commit comments

Comments
 (0)