Add utils for Archlinux

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
This commit is contained in:
Nicolas Lamirault 2016-01-05 13:31:17 +01:00
parent c7fe1f5726
commit 58cdb88537
2 changed files with 7 additions and 3 deletions

View File

@ -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
}

View File

@ -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)