Skip to content

ci: Use gotestum for unit test#201

Open
doanac wants to merge 1 commit into
mainfrom
gotestsum
Open

ci: Use gotestum for unit test#201
doanac wants to merge 1 commit into
mainfrom
gotestsum

Conversation

@doanac

@doanac doanac commented Jul 9, 2026

Copy link
Copy Markdown
Member

go test ./... produces so much output that human eyes struggle to find broken tests. gotestsum produces much cleaner output and summaries of failures for users.

`go test ./...` produces so much output that human eyes struggle to find
broken tests. gotestsum produces much cleaner output and summaries of
failures for users.

Signed-off-by: Andy Doan <doanac@qti.qualcomm.com>
@doanac

doanac commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

@vkhoroz - just a small quality of life improvement. It changes our pages and pages of output to find a single test failure into something like:

$ gotestsum 
✓  auth (cached)
∅  cli/api
∅  cli/config
∅  cli/subcommands
∅  cli/subcommands/configs
∅  cli/subcommands/devices
∅  cli/subcommands/login
∅  cli/subcommands/updates
∅  clock
∅  cmd/cli
✓  cmd/seed (cached)
∅  context
∅  server
∅  server/ui/daemons
∅  server/ui/web/templates
∅  server/ui
✓  server/ui/web (cached)
✓  server/gateway (cached)
✓  server/ui/api (cached)
✖  cmd/server (32ms)
✓  storage (cached)
✓  storage/api (cached)
✓  storage/ostree (cached)
∅  storage/testing
∅  storage/tuf
∅  version
✓  storage/users (cached)
✓  storage/gateway (cached)

=== Skipped
=== SKIP: storage/ostree TestReadFile (0.00s)
    ostree_test.go:29: OSTree repo not available (ref not found: intel-corei7-64-lmp)

=== SKIP: storage/ostree TestReadFileNotFound (0.00s)
    ostree_test.go:45: OSTree repo not available (ref not found: intel-corei7-64-lmp)

=== Failed
=== FAIL: cmd/server TestAuthInitLocal (0.00s)
    auth_init_test.go:26: 
        	Error Trace:	/home/doanac/code/update-server/cmd/server/auth_init_test.go:26
        	Error:      	Not equal: 
        	            	expected: "loclal"
        	            	actual  : "local"
        	            	
        	            	Diff:
        	            	--- Expected
        	            	+++ Actual
        	            	@@ -1 +1 @@
        	            	-loclal
        	            	+local
        	Test:       	TestAuthInitLocal

DONE 183 tests, 2 skipped, 1 failure in 0.701s

@vkhoroz vkhoroz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is nice!

Comment on lines +23 to +26
wget -O gotestsum.tgz https://github.com/gotestyourself/gotestsum/releases/download/v1.13.0/gotestsum_1.13.0_linux_amd64.tar.gz
tar -xf gotestsum.tgz
echo "524bb9d2639f87bdb76db4b32e3b09e0838eec8a5da73c4d30ea2bedc22cf1d7 gotestsum" | sha256sum --check

@vkhoroz vkhoroz Jul 10, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So, there is no way to do this via go install <something>, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can download and build with go install gotest.tools/gotestsum@latest. I figured grabbing a binary would be slightly faster

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants