Skip to content

Commit 2df06c2

Browse files
committed
fix(ci): show test output on failures
Signed-off-by: Leonardo Cecchi <[email protected]>
1 parent e40ba70 commit 2df06c2

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ tasks:
137137
--kube-version ${K8S_VERSION}
138138
--setup-envtest-version ${SETUP_ENVTEST_VERSION}
139139
unit-test --src .
140+
stdout
140141
sources:
141142
- ./**/*.go
142143

dagger/gotest/main.go

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
package main
1616

1717
import (
18-
"context"
1918
"fmt"
2019

2120
"dagger/gotest/internal/dagger"
@@ -29,21 +28,21 @@ type Gotest struct {
2928
}
3029

3130
func New(
32-
// Go version
33-
//
34-
// +optional
35-
// +default="latest"
31+
// Go version
32+
//
33+
// +optional
34+
// +default="latest"
3635
goVersion string,
37-
// setup-envtest version
38-
// +optional
39-
// +default="0.19.0"
36+
// setup-envtest version
37+
// +optional
38+
// +default="0.19.0"
4039
setupEnvtestVersion string,
41-
// Kubernetes version
42-
// +optional
43-
// +default="1.31.0"
40+
// Kubernetes version
41+
// +optional
42+
// +default="1.31.0"
4443
kubeVersion string,
45-
// Container to run the tests
46-
// +optional
44+
// Container to run the tests
45+
// +optional
4746
ctr *dagger.Container,
4847
) *Gotest {
4948
if ctr != nil {
@@ -78,11 +77,10 @@ func New(
7877
}
7978

8079
func (m *Gotest) UnitTest(
81-
ctx context.Context,
82-
// Source directory
83-
// +required
80+
// Source directory
81+
// +required
8482
src *dagger.Directory,
85-
) (string, error) {
83+
) *dagger.Container {
8684
envtestCmd := []string{"setup-envtest", "use", "-p", "path", m.KubeVersion}
8785
return m.Ctr.WithDirectory("/src", src).
8886
// Setup envtest. There is no proper way to install it from a git release, so we use the go install command
@@ -93,5 +91,5 @@ func (m *Gotest) UnitTest(
9391
WithWorkdir("/src").
9492
// Exclude the e2e tests, we don't want to run them here
9593
WithoutDirectory("/src/test/e2e").
96-
WithExec([]string{"go", "test", "./..."}).Stdout(ctx)
94+
WithExec([]string{"go", "test", "./..."})
9795
}

0 commit comments

Comments
 (0)