vulndb/govulncheck: check for dependencies in k8s integration test
Skips testing if unzip and tar dependencies are not available.
Fixes golang/go#47314
Change-Id: I361f3b7fad431c797df8ff7c320542dc2652245d
Reviewed-on: https://go-review.googlesource.com/c/exp/+/336309
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>
diff --git a/vulndb/govulncheck/main_test.go b/vulndb/govulncheck/main_test.go
index abe99e9..6042b28 100644
--- a/vulndb/govulncheck/main_test.go
+++ b/vulndb/govulncheck/main_test.go
@@ -269,6 +269,15 @@
if testing.Short() {
t.Skip("skipping test in short mode.")
}
+
+ // make sure the dependencies are present
+ if _, err := exec.LookPath("tar"); err != nil {
+ t.Skip("tar needed for this test.")
+ }
+ if _, err := exec.LookPath("unzip"); err != nil {
+ t.Skip("unzip needed for this test.")
+ }
+
e := packagestest.Export(t, packagestest.Modules, []packagestest.Module{
{
Name: "foo",