Skip to content

Commit

Permalink
junit-report
Browse files Browse the repository at this point in the history
  • Loading branch information
Amulyam24 committed Sep 17, 2021
1 parent a576624 commit ee1889e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ REGISTRY ?= $(STAGING_REGISTRY)
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
PULL_BASE_REF ?= $(RELEASE_TAG) # PULL_BASE_REF will be provided by Prow
RELEASE_ALIAS_TAG ?= $(PULL_BASE_REF)
REPORT_NAME := $(JUNIT_REPORT_NAME)

TAG ?= dev
ARCH ?= amd64
Expand All @@ -50,7 +51,7 @@ all: manager

# Run tests
test: generate fmt vet manifests
go test ./... -coverprofile cover.out
go test ./... -v 2>&1 | go-junit-report > $(REPORT_NAME).xml

# Build manager binary
manager: generate fmt vet
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/IBM/vpc-go-sdk v0.1.1
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/go-logr/logr v0.4.0
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/onsi/ginkgo v1.16.4
github.com/onsi/gomega v1.13.0
github.com/pkg/errors v0.9.1
Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/
github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
Expand Down
21 changes: 21 additions & 0 deletions scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,27 @@ REPO_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# shellcheck source=../hack/ensure-go.sh
source "${REPO_ROOT}/hack/ensure-go.sh"

# Directory to store JUnit XML test report.
JUNIT_REPORT_DIR=${JUNIT_REPORT_DIR:-}

# If JUNIT_REPORT_DIR is unset, and ARTIFACTS is set, then have them match.
if [[ -z "${JUNIT_REPORT_DIR:-}" && -n "${ARTIFACTS:-}" ]]; then
JUNIT_REPORT_DIR="${ARTIFACTS}"
fi

# Generate prefix for JUnit file name.
junitFilenamePrefix() {
if [[ -z "${JUNIT_REPORT_DIR}" ]]; then
echo ""
return
fi
mkdir -p "${JUNIT_REPORT_DIR}"
DATE=$( date | awk '{print $4}' | base64 )
echo "${JUNIT_REPORT_DIR}/junit_$DATE"
}

export JUNIT_REPORT_NAME=$(junitFilenamePrefix)

cd "${REPO_ROOT}" && \
source ./scripts/fetch_ext_bins.sh && \
fetch_tools && \
Expand Down

0 comments on commit ee1889e

Please sign in to comment.