Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions e2etests/grpc_full_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"context"
"fmt"
"sort"
"strings"
"testing"

"github.com/stackrox/scanner/api/v1/features"
Expand Down Expand Up @@ -96,22 +95,14 @@ func verifyImage(t *testing.T, imgScan *v1.Image, test testCase) {
assert.Truef(t, foundMatch, "Expected to find %s in scan results\nFound the following: %s", expectedVuln.Name, matching.Vulnerabilities)
}
}
// Check feature FixedBy, and provide the related vulnerability if they differ.
if feature.GetFixedBy() != matching.GetFixedBy() {
var vulns []string
for _, v := range matching.GetVulnerabilities() {
if strings.Contains(v.GetFixedBy(), matching.GetFixedBy()) {
vulns = append(vulns, fmt.Sprintf("%s (FixedBy: %s)", v.GetName(), v.GetFixedBy()))
}
}
assert.Equalf(t, len(vulns), 0, "FixedBy: expecting %q, but found %q: Probably due to the following "+
"vulnerabilities (verify if test case needs an update, or if it's a bug): %v)",
feature.GetFixedBy(), matching.GetFixedBy(), vulns)
}

feature.Vulnerabilities = nil
matching.Vulnerabilities = nil

// Clear FixedBy as it changes frequently when new advisories are published.
// The per-vulnerability FixedBy is still checked above via checkGRPCMatch().
feature.FixedBy = ""
matching.FixedBy = ""

// Ensure the parts of the feature aside from the provided executables and vulnerabilities are equal, too.
assert.Equal(t, *feature, *matching)
})
Expand Down
5 changes: 5 additions & 0 deletions e2etests/sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ func verifyImageHasExpectedFeatures(t *testing.T, client *client.Clairify, test
feature.Vulnerabilities = nil
matching.Vulnerabilities = nil

// Clear FixedBy as it changes frequently when new advisories are published.
// The per-vulnerability FixedBy is still checked above via checkMatch().
feature.FixedBy = ""
matching.FixedBy = ""

// Ensure the parts of the feature aside from the provided executables and vulnerabilities are equal, too.
assert.Equal(t, feature, *matching)
})
Expand Down