Add utils for Archlinux
Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
This commit is contained in:
parent
c7fe1f5726
commit
58cdb88537
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user