diff --git a/internal/core/scan.go b/internal/core/scan.go index 353e944..a07800a 100644 --- a/internal/core/scan.go +++ b/internal/core/scan.go @@ -74,6 +74,8 @@ func Scan() ScanResult { } if v.Mod.Path == "k8s.io/api" { kubernetesVersion = strings.ReplaceAll(v.Mod.Version, "v0", "1") + splitted := strings.Split(kubernetesVersion, ".") + kubernetesVersion = strings.Join(splitted[:len(splitted)-1], ".") } if v.Mod.Path == "sigs.k8s.io/controller-runtime" { kubernetesController = true diff --git a/internal/makefile/makefile.go b/internal/makefile/makefile.go index 84541b2..470c955 100644 --- a/internal/makefile/makefile.go +++ b/internal/makefile/makefile.go @@ -269,12 +269,12 @@ endif }, } - testRunner := "go test -shuffle=on" + testRunner := "go test -shuffle=on -p 1 -coverprofile=$@" if sr.UseGinkgo { - testRunner = "ginkgo run --randomize-all" + testRunner = "ginkgo run --randomize-all -output-dir=build" testRule.prerequisites = append(testRule.prerequisites, "install-ginkgo") } - goTest := fmt.Sprintf(`%s $(GO_BUILDFLAGS) -ldflags '%s $(GO_LDFLAGS)' -p 1 -coverprofile=$@ -covermode=count -coverpkg=$(subst $(space),$(comma),$(GO_COVERPKGS)) $(GO_TESTPKGS)`, + goTest := fmt.Sprintf(`%s $(GO_BUILDFLAGS) -ldflags '%s $(GO_LDFLAGS)' -covermode=count -coverpkg=$(subst $(space),$(comma),$(GO_COVERPKGS)) $(GO_TESTPKGS)`, testRunner, makeDefaultLinkerFlags(path.Base(sr.MustModulePath()), sr)) if sr.KubernetesController { testRule.prerequisites = append(testRule.prerequisites, "generate", "install-setup-envtest") @@ -282,6 +282,9 @@ endif } else { testRule.recipe = append(testRule.recipe, `@env $(GO_TESTENV) `+goTest) } + if sr.UseGinkgo { + testRule.recipe = append(testRule.recipe, `@mv build/coverprofile.out build/cover.out`) + } test.addRule(testRule)