Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Go Test Runner #279

Merged
merged 3 commits into from
Aug 1, 2024
Merged

Improve Go Test Runner #279

merged 3 commits into from
Aug 1, 2024

Conversation

flowirtz
Copy link
Contributor

@flowirtz flowirtz commented Jul 30, 2024

This PR improves the golang test runner, both in CI but also locally. In particular, it does these three things to achieve that:

👷 Replace go test with gotestsum

Previously our test output was only in JSON - easy to read for a machine, harder to read for a human.
The gotestsum package is a drop-in replacement for go test and very widely used (e.g. by kubernetes).

Three main improvements it brings are:

  1. Change the test output format, from compact to verbose with color highlighting.
  2. Print a summary of the test run after running all the tests.
  3. write a JUnit XML file for integration with CI systems (used for test summary below)

example test output

👷 Add test summary for Go tests

GitHub previously introduced job summaries, which among other things, provides richer information like shown below rather than just a simple pass/fail. We are now exporting that information to GHA as well.
img

⬆️ Bump actions/setup-go@v4 to v5

Previously we kept getting this deprecation warning, which is further explained here. By bumping the action to v5 that's resolved.
image

@flowirtz flowirtz force-pushed the improve-go-test-runner branch from 5e3af22 to f51eca9 Compare July 30, 2024 10:50
@flowirtz flowirtz changed the title 👷 Replace go test with gotestsum Improve Go Test Runner Jul 30, 2024
@flowirtz flowirtz self-assigned this Jul 30, 2024
@flowirtz flowirtz marked this pull request as ready for review July 30, 2024 11:06
@flowirtz flowirtz force-pushed the improve-go-test-runner branch from e6d3ac8 to 046327a Compare July 30, 2024 12:55
Copy link
Contributor

@dlicheva dlicheva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! Is it worth adding a note to the README, to tell the user that they need to run make install-go-test-tools before testing?

@flowirtz flowirtz force-pushed the improve-go-test-runner branch from 046327a to 61fc504 Compare July 30, 2024 16:06
@flowirtz flowirtz force-pushed the improve-go-test-runner branch from 61fc504 to 7a294df Compare July 31, 2024 10:32
@flowirtz flowirtz force-pushed the improve-go-test-runner branch from 7a294df to 0da2080 Compare August 1, 2024 06:11
@flowirtz flowirtz merged commit 60cbdf9 into main Aug 1, 2024
3 checks passed
@flowirtz flowirtz deleted the improve-go-test-runner branch August 1, 2024 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants