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
|
package packages
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/coreos/clair/database"
|
"github.com/coreos/clair/database"
|
||||||
@ -43,8 +42,7 @@ var rpmPackagesTests = []packagesTest{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRpmPackagesDetector(t *testing.T) {
|
func TestRpmPackagesDetector(t *testing.T) {
|
||||||
_, err := exec.LookPath("rpm")
|
if checkPackageManager("rpm") != nil {
|
||||||
if err != nil {
|
|
||||||
log.Warningf("could not find rpm executable. skipping")
|
log.Warningf("could not find rpm executable. skipping")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ package packages
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os/exec"
|
||||||
"path"
|
"path"
|
||||||
"runtime"
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
@ -36,6 +37,11 @@ func loadFileForTest(name string) []byte {
|
|||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func checkPackageManager(name string) error {
|
||||||
|
_, err := exec.LookPath(name)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func testPackagesDetector(t *testing.T, detector detectors.PackagesDetector, tests []packagesTest) {
|
func testPackagesDetector(t *testing.T, detector detectors.PackagesDetector, tests []packagesTest) {
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
packages, err := detector.Detect(test.data)
|
packages, err := detector.Detect(test.data)
|
||||||
|
Loading…
Reference in New Issue
Block a user