-
Notifications
You must be signed in to change notification settings - Fork 590
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
Restructure E2Es to setup chain in SetupSuite and create channel in SetupTest #1 #6629
Restructure E2Es to setup chain in SetupSuite and create channel in SetupTest #1 #6629
Conversation
…layer and get channel
@@ -0,0 +1,356 @@ | |||
//go:build !test_e2e |
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 created a new file for these tests since the original channel creation options were all a v1
transfer. This was more straightforward than adding conditional logic based on which test was running in the SetupTest
func (s *TransferChannelUpgradesV1TestSuite) SetupTest() { | ||
opts := s.TransferChannelOptions() | ||
opts.Version = transfertypes.V1 | ||
s.SetupPath(ibc.DefaultClientOpts(), opts) | ||
} |
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.
this is the main addition
@@ -55,6 +56,15 @@ type UpgradeTestSuite struct { | |||
testsuite.E2ETestSuite | |||
} | |||
|
|||
func (s *UpgradeTestSuite) SetupTest() { | |||
channelOpts := s.TransferChannelOptions() | |||
// TODO(chatton) hack to handle special case for the v8 to v8.1 upgrade test. |
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.
maybe not the end of the world as it's a once off, I can create an issue for this but it would be nice to have a generalized way of specifying per channel options per test name. Kind of chicken and egg situation as it's happening in SetupTest
@@ -223,7 +233,9 @@ func (s *UpgradeTestSuite) TestChainUpgrade() { | |||
t := s.T() | |||
|
|||
ctx := context.Background() | |||
chain := s.SetupSingleChain(ctx) |
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 opted to remove this fn for now, and more native support for a single chain in a follow up (will create issues soon)
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 got you brother! :D #3160
@@ -64,6 +64,61 @@ type GrandpaTestSuite struct { | |||
testsuite.E2ETestSuite | |||
} | |||
|
|||
func (s *GrandpaTestSuite) SetupSuite() { | |||
s.SetupChains(context.Background(), nil, func(options *testsuite.ChainOptions) { |
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.
configuration remained unchanged
channelOpts := defaultChannelOpts(chains) | ||
chain1, chain2 := chains[i], chains[i+1] | ||
|
||
if modificationProvider != nil { |
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.
provides a mechanism to selectively modify channels when there are more than 2 chains in a test.
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.
provide me modifications, almighty provider! 🙌🏻
}) | ||
} | ||
|
||
s.startRelayerFn = func(relayer ibc.Relayer) { | ||
// depending on the test, the path names will be different. | ||
// whenever a relayer is started, it should use the paths associated with the test the relayer is running in. | ||
pathNames, ok := s.testPaths[s.T().Name()] |
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.
path names only needs to be correct for rly
, it is a no-op for hermes
func (s *E2ETestSuite) GetPathName(idx int64) string { | ||
pathName := fmt.Sprintf("%s-path-%d", s.T().Name(), idx) | ||
func GetPathName(idx int64) string { | ||
pathName := fmt.Sprintf("path-%d", idx) |
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.
removing the name from the string as s.T().Name()
is different depending on the context of the invocation. using an incrementing int will behave as expected everywhere.
looks like there are some client tests failing, definitely related will investigate these |
|
||
// SetupSuite will by default create chains with no additional options. If additional options are required, | ||
// the test suite must define the SetupSuite function and provide the required options. | ||
func (s *E2ETestSuite) SetupSuite() { |
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.
Just to be clear, this means that all tests in one suite will share the same chains, and so we must be careful that accounts are not shared across the tests to avoid account sequence mismatches, resusing balances, etc, etc.
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.
yes that's correct! By default we are always generating addresses that won't collide by default, but we need to keep this in mind in case we end up encountering a new category of error
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.
Yeah, I think that will help a lot with running e2e tests faster, which is a big win!
e2e/testsuite/testsuite.go
Outdated
// GetChannel returns the ibc.ChannelOutput for the current test. | ||
// this defaults to the first entry in the list, and will be what is needed in the case of | ||
// a single channel test. | ||
func (s *E2ETestSuite) GetChannel() ibc.ChannelOutput { |
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.
Would it better to rename this to be more precise? Either something like GetChainAChannel or refactor it to take in chain1 and chain2 to get the channel between them? A bit more verbose, but also potentially useful in more contexts?
I guess my lens is a bit skewed with all the forwarding tests, so feel free to ignore :D
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.
Not a bad idea to be explicit here, I think GetChainAChannel
would be better.
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.
LGTM! Really nice improvements made in this PR, love it ❤️
I think we can follow up separately with any of the next steps, would be in favour of merging this sooner than later! 🚢 🚢 🚢
@@ -223,7 +233,9 @@ func (s *UpgradeTestSuite) TestChainUpgrade() { | |||
t := s.T() | |||
|
|||
ctx := context.Background() | |||
chain := s.SetupSingleChain(ctx) |
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 got you brother! :D #3160
e2e/testsuite/testsuite.go
Outdated
transferVersion = transfertypes.V2 | ||
} | ||
|
||
func (s *E2ETestSuite) FeeMiddlewareChannelOptions() ibc.CreateChannelOptions { |
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.
mega nit, I see this was actually named this a long time ago, but would be nice if it was FeeTransferChannelOptions
imo!
// TODO: we need to create a relayer for each test that will run | ||
// having a single relayer for all tests will cause issues when running tests in parallel. |
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.
Assuming this TODO is directly related to the one onGetRelayer
below on this file.
What issues get caused by having a single relayer for tests running in parallel? 🤔 Just curious about the specifics
We can create an issue to follow up on this too ofc! 👍🏻
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.
In lots of tests we don't have a relayer started at the beginning, e.g. when doing a message transfer. So another test who has started a relayer, will cause that relayer to relay packets on a different test causing assertions to fail.
channelOpts := defaultChannelOpts(chains) | ||
chain1, chain2 := chains[i], chains[i+1] | ||
|
||
if modificationProvider != nil { |
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.
provide me modifications, almighty provider! 🙌🏻
I think we should do something about the wasm e2e tests which are failing 🤔 |
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 agree that this would be good to get merged sooner rather than later with follow-up issues - as long as the tests run OK :)
sorry if I wasn't clear, the plan was already to do those things in follow ups! Will merge as soon as I have passing tests for all non-wasm E2Es! |
4084011
to
0af42e9
Compare
…mber-of-runners-used
…mber-of-runners-used
Quality Gate passed for 'ibc-go'Issues Measures |
…etupTest #1 (#6629) * wip: refactoring tests to create chains in SetupSuite * chore: refactoring memo test to use new setup fns * chore: replace calls to setup chains and relayer with calls to get relayer and get channel * chore: fix wiring in ThreeChainSetup * chore: remove unused fn * chore: add modification function based on chain inputs * chore: update grandpa test with new structure * chore: remove single chain methods * chore: move upgrade tests into different files * chore: fixing client tests * chore: use paths associated with the test * chore: add getter to fetch paths * chore: fix client tests * chore: fix misbehaviour test * chore: fix misbehaviour test * chore: mereg main * chore: pr feedback
Description
This PR addresses the first step of the overall restructuring of E2Es to allow for multiple tests running on an individual host.
The main differences introduced in this PR are.
SetupChainsRelayerAndChannel
function has been removed. Instead, the chains get created inSetupSuite
and the channels get created inSetupTest
.SetupTest
orSetupSuite
functions as required.Follow up PRs will handle.
t.Parallel
to enable parallel test execution.shout out to @anhductn2001 for the work on the first iteration of this.
ref: #5317
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
).godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.