diff --git a/worker/detectors/packages/rpm_test.go b/worker/detectors/packages/rpm_test.go index d8ffb22b..44bc8736 100644 --- a/worker/detectors/packages/rpm_test.go +++ b/worker/detectors/packages/rpm_test.go @@ -15,7 +15,6 @@ package packages import ( - "os/exec" "testing" "github.com/coreos/clair/database" @@ -43,8 +42,7 @@ var rpmPackagesTests = []packagesTest{ } func TestRpmPackagesDetector(t *testing.T) { - _, err := exec.LookPath("rpm") - if err != nil { + if checkPackageManager("rpm") != nil { log.Warningf("could not find rpm executable. skipping") return } diff --git a/worker/detectors/packages/test.go b/worker/detectors/packages/test.go index 5527c9f1..f2a2e540 100644 --- a/worker/detectors/packages/test.go +++ b/worker/detectors/packages/test.go @@ -16,6 +16,7 @@ package packages import ( "io/ioutil" + "os/exec" "path" "runtime" "testing" @@ -36,6 +37,11 @@ func loadFileForTest(name string) []byte { return d } +func checkPackageManager(name string) error { + _, err := exec.LookPath(name) + return err +} + func testPackagesDetector(t *testing.T, detector detectors.PackagesDetector, tests []packagesTest) { for _, test := range tests { packages, err := detector.Detect(test.data)