|
9 | 9 | "context" |
10 | 10 | "fmt" |
11 | 11 | "sort" |
12 | | - "strings" |
13 | 12 | "testing" |
14 | 13 |
|
15 | 14 | "github.com/stackrox/scanner/api/v1/features" |
@@ -96,22 +95,14 @@ func verifyImage(t *testing.T, imgScan *v1.Image, test testCase) { |
96 | 95 | assert.Truef(t, foundMatch, "Expected to find %s in scan results\nFound the following: %s", expectedVuln.Name, matching.Vulnerabilities) |
97 | 96 | } |
98 | 97 | } |
99 | | - // Check feature FixedBy, and provide the related vulnerability if they differ. |
100 | | - if feature.GetFixedBy() != matching.GetFixedBy() { |
101 | | - var vulns []string |
102 | | - for _, v := range matching.GetVulnerabilities() { |
103 | | - if strings.Contains(v.GetFixedBy(), matching.GetFixedBy()) { |
104 | | - vulns = append(vulns, fmt.Sprintf("%s (FixedBy: %s)", v.GetName(), v.GetFixedBy())) |
105 | | - } |
106 | | - } |
107 | | - assert.Equalf(t, len(vulns), 0, "FixedBy: expecting %q, but found %q: Probably due to the following "+ |
108 | | - "vulnerabilities (verify if test case needs an update, or if it's a bug): %v)", |
109 | | - feature.GetFixedBy(), matching.GetFixedBy(), vulns) |
110 | | - } |
111 | | - |
112 | 98 | feature.Vulnerabilities = nil |
113 | 99 | matching.Vulnerabilities = nil |
114 | 100 |
|
| 101 | + // Clear FixedBy as it changes frequently when new advisories are published. |
| 102 | + // The per-vulnerability FixedBy is still checked above via checkGRPCMatch(). |
| 103 | + feature.FixedBy = "" |
| 104 | + matching.FixedBy = "" |
| 105 | + |
115 | 106 | // Ensure the parts of the feature aside from the provided executables and vulnerabilities are equal, too. |
116 | 107 | assert.Equal(t, *feature, *matching) |
117 | 108 | }) |
|
0 commit comments