Skip to content

ci/unit-tests: add verbose mode with Ginkgo #59

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

Merged
merged 1 commit into from
Apr 16, 2025

Conversation

ldevulder
Copy link
Member

Add verbose mode to have all messages in the unit-tests log, as some are not showned by default. Could be useful for debugging purposes.

@ldevulder ldevulder self-assigned this Apr 15, 2025
@ldevulder ldevulder requested a review from a team as a code owner April 15, 2025 08:53
@dirkmueller
Copy link
Member

dirkmueller commented Apr 15, 2025

imho this is too verbose by default. how about we make it optional, triggerable via an extra V=1 parameter:

--- a/Makefile
+++ b/Makefile
@@ -12,17 +12,23 @@ LDFLAGS:=-w -s
 LDFLAGS+=-X "$(GO_MODULE)/internal/cli/cmd.version=$(GIT_TAG)"
 LDFLAGS+=-X "$(GO_MODULE)/internal/cli/cmd.gitCommit=$(GIT_COMMIT)"
 
+ifeq ($(V),1)
+  VERBOSE=-v
+else
+  VERBOSE=
+endif
+
 elemental:
        go build -ldflags '$(LDFLAGS)' -o $@ ./cmd/...
 
 .PHONY: unit-tests
 unit-tests:
-       go run $(GINKGO) --label-filter '!rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${PKG}
+       go run $(GINKGO) --label-filter '!rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${VERBOSE} ${PKG}
 ifeq (, $(shell which rootlesskit 2>/dev/null))
        @echo "No rootlesskit utility found, not executing tests requiring it"
 else
        @mv coverprofile.out coverprofile.out.bk
-       rootlesskit go run $(GINKGO) --label-filter 'rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${PKG}
+       rootlesskit go run $(GINKGO) --label-filter 'rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${VERBOSE} ${PKG}
        @grep -v "mode: atomic" coverprofile.out >> coverprofile.out.bk
        @mv coverprofile.out.bk coverprofile.out
 endif

@ldevulder
Copy link
Member Author

imho this is too verbose by default. how about we make it optional, triggerable via an extra V=1 parameter:

We can yes for those who execute the unit-tests locally. I will just enable this for the CI, as I want to be able to have all logs for each merge (easier to analyse in case of issue). I will do a fix.

Add verbose mode to have all messages in the unit-tests log, as some are
not showned by default. Could be useful for debugging purposes.

Signed-off-by: Loic Devulder <ldevulder@suse.com>
@ldevulder ldevulder force-pushed the ci-add-verbose-unit-tests branch from 15ad331 to 3b60394 Compare April 15, 2025 14:07
Copy link
Member

@fgiudici fgiudici left a comment

Choose a reason for hiding this comment

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

LGTM

@dirkmueller dirkmueller merged commit 135f5e1 into SUSE:main Apr 16, 2025
2 checks passed
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.

3 participants