Skip to content

Commit

Permalink
e2e: improve logging (#1268)
Browse files Browse the repository at this point in the history
  • Loading branch information
RTann authored Oct 18, 2023
1 parent 4d87d65 commit aa7eb8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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

0 comments on commit aa7eb8d

Please sign in to comment.