diff --git a/internal/infrastructure/cronstore/store_test.go b/internal/infrastructure/cronstore/store_test.go index 39245e6d6..496ef5fbb 100644 --- a/internal/infrastructure/cronstore/store_test.go +++ b/internal/infrastructure/cronstore/store_test.go @@ -504,6 +504,3 @@ func itoa(n int) string { } return string(buf[i:]) } - -//go:fix inline -func stringPtr(s string) *string { return new(s) } diff --git a/internal/plugin/architecture_test.go b/internal/plugin/architecture_test.go index 1fc62ce64..ae61fbcbe 100644 --- a/internal/plugin/architecture_test.go +++ b/internal/plugin/architecture_test.go @@ -4,7 +4,6 @@ import ( "go/ast" "go/parser" "go/token" - "io/fs" "maps" "os" "path/filepath" @@ -164,58 +163,6 @@ type engineFamily struct { singleOwner bool } -func inspectEngineFamilies(root string) ([]engineFamily, error) { - dirs := make(map[string]struct{}) - err := filepath.WalkDir(root, func(path string, entry fs.DirEntry, walkErr error) error { - if walkErr != nil { - return walkErr - } - if entry.IsDir() { - dirs[path] = struct{}{} - } - return nil - }) - if err != nil { - return nil, err - } - - var families []engineFamily - for dir := range dirs { - packages, err := parsePackageFiles(dir) - if err != nil { - return nil, err - } - for _, files := range packages { - families = append(families, engineFamiliesInPackage(root, dir, files)...) - } - } - slices.SortFunc(families, func(a, b engineFamily) int { - return strings.Compare(a.packagePath+"."+a.engineName, b.packagePath+"."+b.engineName) - }) - return families, nil -} - -func parsePackageFiles(dir string) (map[string][]*ast.File, error) { - entries, err := os.ReadDir(dir) - if err != nil { - return nil, err - } - - packages := make(map[string][]*ast.File) - fileSet := token.NewFileSet() - for _, entry := range entries { - if entry.IsDir() || !strings.HasSuffix(entry.Name(), ".go") || strings.HasSuffix(entry.Name(), "_test.go") { - continue - } - file, err := parser.ParseFile(fileSet, filepath.Join(dir, entry.Name()), nil, 0) - if err != nil { - return nil, err - } - packages[file.Name.Name] = append(packages[file.Name.Name], file) - } - return packages, nil -} - func engineFamiliesInPackage(root, dir string, files []*ast.File) []engineFamily { engines := make(map[string]bool) interfaces := make(map[string]*ast.InterfaceType) diff --git a/internal/releaseupdate/install_script_test.go b/internal/releaseupdate/install_script_test.go index 79e4af7f7..cf826270f 100644 --- a/internal/releaseupdate/install_script_test.go +++ b/internal/releaseupdate/install_script_test.go @@ -123,6 +123,8 @@ func TestUpdateWatchdogRollsBackManagedWorkerImageAndReportsOnlyChangedComponent func runUpdateInstallScript(t *testing.T, environment map[string]string) (Result, []string) { t.Helper() + ctx := t.Context() + root, err := filepath.Abs(filepath.Join("..", "..")) if err != nil { t.Fatal(err) @@ -199,7 +201,7 @@ printf '%s\n' "cp $*" >> "$ARCHIE_TEST_CALLS" if err := os.WriteFile(scriptPath, scriptData, 0o755); err != nil { t.Fatal(err) } - cmd := exec.Command(scriptPath) + cmd := exec.CommandContext(ctx, scriptPath) cmd.Env = append( os.Environ(), "PATH="+fakeDir+":"+os.Getenv("PATH"), @@ -254,6 +256,8 @@ func writeFakeCommand(t *testing.T, dir, name, body string) { func runUpdateWatchdogFailure(t *testing.T, components string) (Report, string, []string) { t.Helper() + ctx := t.Context() + root, err := filepath.Abs(filepath.Join("..", "..")) if err != nil { t.Fatal(err) @@ -279,7 +283,7 @@ func runUpdateWatchdogFailure(t *testing.T, components string) (Report, string, writeFakeCommand(t, fakeDir, "docker", `printf '%s\n' "docker $*" >> "$ARCHIE_TEST_CALLS"`) callsPath := filepath.Join(work, "calls") - cmd := exec.Command(filepath.Join(root, "scripts", "archie-update-watchdog")) + cmd := exec.CommandContext(ctx, filepath.Join(root, "scripts", "archie-update-watchdog")) cmd.Env = append( os.Environ(), "PATH="+fakeDir+":"+os.Getenv("PATH"),