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

Improve coverage report statistics for integration tests #1013

Closed
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
32 changes: 32 additions & 0 deletions internal/test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,38 @@ func testCode(
runner := cdcTests.NewTestRunner()
if coverageEnabled {
coverageReport = runtime.NewCoverageReport()
contracts := map[string]string{
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: I am sure there's a way to get these mapping dynamically, I have just hardcoded it here to illustrate my point. We'll update it to dynamically fetch all the available system contracts, as new ones we'll probably be introduced in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be better suitable for the cadence-tools/test repository.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: Opened onflow/cadence-tools#110 in favor of this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update: Opened onflow/cadence-tools#110 in favor of this.

"FlowToken": "0x0ae53cb6e3f42a79",
"FlowFees": "0xe5a8b7f23e8b548f",
"FungibleToken": "0xee82856bf20e2aa6",
"FlowClusterQC": "0xf8d6e0586b0a20c7",
"FlowDKG": "0xf8d6e0586b0a20c7",
"FlowEpoch": "0xf8d6e0586b0a20c7",
"FlowIDTableStaking": "0xf8d6e0586b0a20c7",
"FlowServiceAccount": "0xf8d6e0586b0a20c7",
"FlowStakingCollection": "0xf8d6e0586b0a20c7",
"FlowStorageFees": "0xf8d6e0586b0a20c7",
"LockedTokens": "0xf8d6e0586b0a20c7",
"NodeVersionBeacon": "0xf8d6e0586b0a20c7",
"StakingProxy": "0xf8d6e0586b0a20c7",
"ExampleNFT": "0xf8d6e0586b0a20c7",
"FUSD": "0xf8d6e0586b0a20c7",
"NFTStorefront": "0xf8d6e0586b0a20c7",
"NFTStorefrontV2": "0xf8d6e0586b0a20c7",
}
for name, address := range contracts {
addr, _ := common.HexToAddress(address)
location := common.AddressLocation{
Address: addr,
Name: name,
}
coverageReport.ExcludeLocation(location)
}
coverageReport.WithLocationInspectionHandler(func(location common.Location) bool {
_, addressLoc := location.(common.AddressLocation)
_, stringLoc := location.(common.StringLocation)
return addressLoc || stringLoc
})
runner = runner.WithCoverageReport(coverageReport)
}

Expand Down