Skip to content

Commit 135f5e1

Browse files
ldevulderdirkmueller
authored andcommitted
ci/unit-tests: add verbose mode with Ginkgo
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>
1 parent 522b92e commit 135f5e1

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/unit_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
run: |
3232
set -e
3333
34-
make unit-tests
34+
make VERBOSE=true unit-tests
3535
3636
# Remove mock files from coverage analysis
3737
sed -n -i '/\/mock\//!p' coverprofile.out

Makefile

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,22 @@ LDFLAGS:=-w -s
1212
LDFLAGS+=-X "$(GO_MODULE)/internal/cli/cmd.version=$(GIT_TAG)"
1313
LDFLAGS+=-X "$(GO_MODULE)/internal/cli/cmd.gitCommit=$(GIT_COMMIT)"
1414

15+
# No verbose unit tests by default
16+
ifeq ($(VERBOSE),true)
17+
VERBOSE_TEST?=-v
18+
endif
19+
1520
elemental:
1621
go build -ldflags '$(LDFLAGS)' -o $@ ./cmd/...
1722

1823
.PHONY: unit-tests
1924
unit-tests:
20-
go run $(GINKGO) --label-filter '!rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${PKG}
25+
go run $(GINKGO) --label-filter '!rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r $(VERBOSE_TEST) ${PKG}
2126
ifeq (, $(shell which rootlesskit 2>/dev/null))
2227
@echo "No rootlesskit utility found, not executing tests requiring it"
2328
else
2429
@mv coverprofile.out coverprofile.out.bk
25-
rootlesskit go run $(GINKGO) --label-filter 'rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r ${PKG}
30+
rootlesskit go run $(GINKGO) --label-filter 'rootlesskit' --race --cover --coverpkg=github.com/suse/elemental/... --github-output -p -r $(VERBOSE_TEST) ${PKG}
2631
@grep -v "mode: atomic" coverprofile.out >> coverprofile.out.bk
2732
@mv coverprofile.out.bk coverprofile.out
2833
endif

0 commit comments

Comments
 (0)