mirror of
https://github.com/anchore/grype
synced 2024-11-10 06:34:13 +00:00
test: add integration corner cases for Alpine
Signed-off-by: Alfredo Deza <adeza@anchore.com>
This commit is contained in:
parent
905cae5377
commit
e0db0c1145
2 changed files with 49 additions and 0 deletions
43
test/integration/corner_cases_test.go
Normal file
43
test/integration/corner_cases_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
v1 "github.com/anchore/grype-db/pkg/db/v1"
|
||||
"github.com/anchore/grype/grype"
|
||||
"github.com/anchore/grype/grype/vulnerability"
|
||||
"github.com/anchore/syft/syft/scope"
|
||||
)
|
||||
|
||||
func TestApkNoVersion(t *testing.T) {
|
||||
store := mockStore{
|
||||
backend: map[string]map[string][]v1.Vulnerability{
|
||||
"nvd": {
|
||||
"libvncserver": []v1.Vulnerability{
|
||||
{
|
||||
ID: "CVE-2010-5304",
|
||||
VersionConstraint: "< 0.9.9",
|
||||
VersionFormat: "unknown",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
results, _, _, err := grype.FindVulnerabilities(
|
||||
vulnerability.NewProviderFromStore(&store),
|
||||
"dir://test-fixtures/corner-cases/apk",
|
||||
scope.AllLayersScope,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to find vulnerabilities: %+v", err)
|
||||
}
|
||||
|
||||
for result := range results.Enumerate() {
|
||||
fmt.Printf("%v\n", result)
|
||||
}
|
||||
if len(results.Enumerate()) != 1 {
|
||||
t.Errorf("vulnerability count does not match '%d' != '%d'", len(results.Enumerate()), 1)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
NAME="Alpine Linux"
|
||||
ID=alpine
|
||||
VERSION_ID=3.12.0
|
||||
PRETTY_NAME="Alpine Linux v3.12"
|
||||
HOME_URL="https://alpinelinux.org/"
|
||||
BUG_REPORT_URL="https://bugs.alpinelinux.org/"
|
Loading…
Reference in a new issue