-
Notifications
You must be signed in to change notification settings - Fork 835
test: add import compliance tests #4537
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
base: master
Are you sure you want to change the base?
Conversation
tests/imports_test.go
Outdated
|
|
||
| // TestLibevmImportsAreAllowed ensures that all libevm imports in the graft directory | ||
| // are explicitly allowed via the libevm-allowed-packages.txt file. | ||
| func TestLibevmImportsAreAllowed(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here for the source of the code below.
| @@ -0,0 +1,57 @@ | |||
| # Forbidden geth upstream files that cannot be imported outside the graft directory. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered translating both of these files to .json to make the loading and parsing simpler in loadPatternFile().
However, the text files are very human readable and easy to maintain. Would like any opinions about the tradeoffs here!
Why this should be merged
This PR accomplishes three things:
graft/directory from importing old, upstreamgeth filesvms/evmdirectory from importing packages within thegraft/directory.graft/*and be enforced, but moving it here will prevent the testing from being duplicated betweencorethandsubnet-evmHow this works
The boundaries are as follows:
graft/corethcan be imported everywhere in AvalancheGo exceptvms/evm.vms/evm/emulateis an exception to this rulegraft/subnet-evmcan not be imported anywhere in AvalancheGovms/evm/emulateis an exception to this ruleHow this was tested
Existing CI. I also added a sample "bad" commit (404acd5) to show how CI would behave.

edit: this is no longer a good example -- pretend the file is in
vms/evm/sample_bad.go.Need to be documented in RELEASES.md?
No