fix(ci): show test output on failures (#461)

Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
This commit is contained in:
Leonardo Cecchi 2025-08-14 22:52:54 +02:00 committed by GitHub
parent b2645827b8
commit 3a770798c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View File

@ -137,6 +137,7 @@ tasks:
--kube-version ${K8S_VERSION} --kube-version ${K8S_VERSION}
--setup-envtest-version ${SETUP_ENVTEST_VERSION} --setup-envtest-version ${SETUP_ENVTEST_VERSION}
unit-test --src . unit-test --src .
stdout
sources: sources:
- ./**/*.go - ./**/*.go

View File

@ -15,7 +15,6 @@
package main package main
import ( import (
"context"
"fmt" "fmt"
"dagger/gotest/internal/dagger" "dagger/gotest/internal/dagger"
@ -78,11 +77,10 @@ func New(
} }
func (m *Gotest) UnitTest( func (m *Gotest) UnitTest(
ctx context.Context,
// Source directory // Source directory
// +required // +required
src *dagger.Directory, src *dagger.Directory,
) (string, error) { ) *dagger.Container {
envtestCmd := []string{"setup-envtest", "use", "-p", "path", m.KubeVersion} envtestCmd := []string{"setup-envtest", "use", "-p", "path", m.KubeVersion}
return m.Ctr.WithDirectory("/src", src). return m.Ctr.WithDirectory("/src", src).
// Setup envtest. There is no proper way to install it from a git release, so we use the go install command // 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(
WithWorkdir("/src"). WithWorkdir("/src").
// Exclude the e2e tests, we don't want to run them here // Exclude the e2e tests, we don't want to run them here
WithoutDirectory("/src/test/e2e"). WithoutDirectory("/src/test/e2e").
WithExec([]string{"go", "test", "./..."}).Stdout(ctx) WithExec([]string{"go", "test", "./..."})
} }