Skip to content

Commit aa7eb8d

Browse files
authored
e2e: improve logging (#1268)
1 parent 4d87d65 commit aa7eb8d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

e2etests/grpc_full_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func verifyImage(t *testing.T, imgScan *v1.Image, test testCase) {
9393
foundMatch = true
9494
checkGRPCMatch(t, expectedVuln, matchingVuln)
9595
}
96-
assert.Truef(t, foundMatch, "Expected to find %s in scan results", expectedVuln.Name)
96+
assert.Truef(t, foundMatch, "Expected to find %s in scan results\nFound the following: %s", expectedVuln.Name, matching.Vulnerabilities)
9797
}
9898
}
9999
// Check feature FixedBy, and provide the related vulnerability if they differ.

e2etests/sanity_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ func verifyImageHasExpectedFeatures(t *testing.T, client *client.Clairify, test
9393
feature.Executables = nil
9494
matching.Executables = nil
9595

96+
matchingBytes, _ := json.MarshalIndent(matching.Vulnerabilities, "", " ")
9697
if !test.onlyCheckSpecifiedVulns {
9798
if len(matching.Vulnerabilities) != len(feature.Vulnerabilities) {
98-
matchingBytes, _ := json.MarshalIndent(matching.Vulnerabilities, "", " ")
9999
featureVulnsBytes, _ := json.MarshalIndent(feature.Vulnerabilities, "", " ")
100-
fmt.Printf("Matching: %s\n", matchingBytes)
101-
fmt.Printf("Expected Feature: %s\n", featureVulnsBytes)
100+
fmt.Printf("Matching: %s\n", string(matchingBytes))
101+
fmt.Printf("Expected Feature: %s\n", string(featureVulnsBytes))
102102
}
103103

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

0 commit comments

Comments
 (0)