Skip to content

Commit

Permalink
maint: upload test results to CircleCI & add Go 1.22 to test matrix (#…
Browse files Browse the repository at this point in the history
…108)

We upload test reports for smoke tests for friendlier error reporting
and tracking flaky tests. This lets us do that for unit tests, too.

## Which problem is this PR solving?

- Friendlier error reporting in CI.
- Test coverage for recently release Go 1.22.

## Short description of the changes

- gotestsum is on Circle's current Go runners, so we can use it to
produce xUnit XML test run reports to upload to Circle.
- New Go is out. Let's test against it.

## How to verify that this has the expected result

A unit test build's "TESTS" tab at Circle will have data instead of
reporting "0 test results uploaded".
  • Loading branch information
robbkidd authored Feb 14, 2024
1 parent ce81eef commit 9a50544
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ version: 2.1
matrix_goversions: &matrix_goversions
matrix:
parameters:
goversion: ["20", "21"]
goversion: ["20", "21", "22"]

default_goversion: &default_goversion "21"
default_goversion: &default_goversion "22"

orbs:
bats: circleci/bats@1.0.0
Expand All @@ -24,6 +24,8 @@ jobs:
keys:
- v1-go-mod-{{ checksum "go.sum" }}
- run: make test
- store_test_results:
path: test_results
- save_cache:
key: v1-go-mod-{{ checksum "go.sum" }}
paths:
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ clean:
rm -rf ./smoke-tests/collector/data-results/*.json
rm -rf ./smoke-tests/report.*

GOTESTCMD = $(if $(shell command -v gotestsum),gotestsum --junitfile ./test_results/$(1).xml --format testname --,go test)

test:
go test -v ./...
$(call GOTESTCMD,$@) -v ./...

smoke-tests/collector/data.json:
@echo ""
Expand Down Expand Up @@ -44,4 +46,4 @@ resmoke: unsmoke smoke

.PHONY: docker_compose_present
docker_compose_present:
@which docker-compose || (echo "Required docker-compose command is missing"; exit 1)
@which docker-compose || (echo "Required docker-compose command is missing"; exit 1)

0 comments on commit 9a50544

Please sign in to comment.