Skip to content

Commit 37c4809

Browse files
committed
feat: generate coverage for the integration tests
Use all canonical module paths to generate `coverpkg`. Signed-off-by: Artem Chernyshev <artem.chernyshev@talos-systems.com>
1 parent 5c988d4 commit 37c4809

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

internal/project/auto/integration_tests.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@
55
package auto
66

77
import (
8+
"fmt"
9+
"path/filepath"
10+
"strings"
11+
812
"github.com/siderolabs/gen/maps"
13+
"github.com/siderolabs/gen/xslices"
914

1015
"github.com/siderolabs/kres/internal/project/common"
1116
"github.com/siderolabs/kres/internal/project/golang"
@@ -31,7 +36,17 @@ func (builder *builder) BuildIntegrationTests() error {
3136
}
3237

3338
for _, spec := range integrationTests.Tests {
34-
build := golang.NewBuild(builder.meta, spec.Name, spec.Path, "go test -c -covermode=atomic")
39+
build := golang.NewBuild(builder.meta, spec.Name, spec.Path,
40+
fmt.Sprintf(
41+
"go test -c -covermode=atomic -coverprofile=coverage.txt -coverpkg=%s",
42+
strings.Join(
43+
xslices.Map(builder.meta.CanonicalPaths, func(s string) string {
44+
return filepath.Join(s, "/...")
45+
}),
46+
",",
47+
),
48+
),
49+
)
3550

3651
build.Outputs = maps.Map(spec.Outputs, func(k string, m map[string]string) (string, golang.CompileConfig) {
3752
return k, golang.CompileConfig(m)

0 commit comments

Comments
 (0)