Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e: improve logging #1268

Merged
merged 1 commit into from
Oct 18, 2023
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
2 changes: 1 addition & 1 deletion e2etests/grpc_full_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func verifyImage(t *testing.T, imgScan *v1.Image, test testCase) {
foundMatch = true
checkGRPCMatch(t, expectedVuln, matchingVuln)
}
assert.Truef(t, foundMatch, "Expected to find %s in scan results", expectedVuln.Name)
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.
Expand Down
8 changes: 4 additions & 4 deletions e2etests/sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ func verifyImageHasExpectedFeatures(t *testing.T, client *client.Clairify, test
feature.Executables = nil
matching.Executables = nil

matchingBytes, _ := json.MarshalIndent(matching.Vulnerabilities, "", " ")
if !test.onlyCheckSpecifiedVulns {
if len(matching.Vulnerabilities) != len(feature.Vulnerabilities) {
matchingBytes, _ := json.MarshalIndent(matching.Vulnerabilities, "", " ")
featureVulnsBytes, _ := json.MarshalIndent(feature.Vulnerabilities, "", " ")
fmt.Printf("Matching: %s\n", matchingBytes)
fmt.Printf("Expected Feature: %s\n", featureVulnsBytes)
fmt.Printf("Matching: %s\n", string(matchingBytes))
fmt.Printf("Expected Feature: %s\n", string(featureVulnsBytes))
}

require.Equal(t, len(feature.Vulnerabilities), len(matching.Vulnerabilities))
Expand All @@ -116,7 +116,7 @@ func verifyImageHasExpectedFeatures(t *testing.T, client *client.Clairify, test
foundMatch = true
checkMatch(t, test.source, expectedVuln, matchingVuln)
}
assert.Truef(t, foundMatch, "Expected to find %s in scan results", expectedVuln.Name)
assert.Truef(t, foundMatch, "Expected to find %s in scan results\nFound the following: %s", expectedVuln.Name, string(matchingBytes))
}
}
feature.Vulnerabilities = nil
Expand Down