-
Notifications
You must be signed in to change notification settings - Fork 606
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
tests: add option to dump genesis files in E2E tests #6100
Conversation
WalkthroughThe overarching change across the end-to-end (E2E) test suite involves adding support for dumping genesis files for debugging purposes. This is achieved by introducing a new configuration method, Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
e2e/scripts/run-e2e.sh
Outdated
@@ -59,7 +59,7 @@ _verify_dependencies | |||
|
|||
# if the dev configs directory is present, enable fzf completion to select a test config file to use. | |||
if [[ -d "dev-configs" ]]; then | |||
export E2E_CONFIG_PATH="$(pwd)/dev-configs/$(_select_test_config)" | |||
export E2E_CONFIG_PATH="/workspaces/ibc-go/e2e/dev-configs/config.yaml" |
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 needs to be reverted before review. I had to do it as I don't have fzf available on github codespaces
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.
Actionable comments posted: 1
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (20)
- e2e/tests/core/02-client/client_test.go (1 hunks)
- e2e/tests/core/03-connection/connection_test.go (1 hunks)
- e2e/tests/interchain_accounts/base_test.go (1 hunks)
- e2e/tests/interchain_accounts/gov_test.go (1 hunks)
- e2e/tests/interchain_accounts/groups_test.go (1 hunks)
- e2e/tests/interchain_accounts/incentivized_test.go (1 hunks)
- e2e/tests/interchain_accounts/localhost_test.go (1 hunks)
- e2e/tests/interchain_accounts/params_test.go (1 hunks)
- e2e/tests/interchain_accounts/query_test.go (1 hunks)
- e2e/tests/interchain_accounts/upgrades_test.go (1 hunks)
- e2e/tests/transfer/authz_test.go (1 hunks)
- e2e/tests/transfer/base_test.go (1 hunks)
- e2e/tests/transfer/incentivized_test.go (1 hunks)
- e2e/tests/transfer/localhost_test.go (1 hunks)
- e2e/tests/transfer/upgrades_test.go (1 hunks)
- e2e/tests/upgrades/genesis_test.go (1 hunks)
- e2e/tests/upgrades/upgrade_test.go (1 hunks)
- e2e/testsuite/diagnostics/diagnostics.go (2 hunks)
- e2e/testsuite/testconfig.go (7 hunks)
- e2e/testsuite/testsuite.go (2 hunks)
Additional comments not posted (24)
e2e/tests/interchain_accounts/gov_test.go (1)
31-33
: Ensure theConfigureGenesisDebugExport
method is implemented correctly and adheres to the intended debug export configuration for Genesis files.e2e/tests/core/03-connection/connection_test.go (1)
28-30
: Ensure theConfigureGenesisDebugExport
method is correctly implemented to enable Genesis file debugging as intended.e2e/tests/interchain_accounts/query_test.go (1)
29-31
: Confirm that theConfigureGenesisDebugExport
method is implemented as expected to facilitate Genesis file debugging.e2e/testsuite/diagnostics/diagnostics.go (1)
165-166
: The renaming ofgetE2EDir
toGetE2EDir
improves consistency and clarity in naming conventions. Ensure that all references to this function have been updated accordingly.e2e/tests/transfer/localhost_test.go (1)
23-25
: Verify that theConfigureGenesisDebugExport
method is correctly implemented to enable Genesis file debugging for theLocalhostTransferTestSuite
.e2e/tests/interchain_accounts/groups_test.go (1)
62-64
: Ensure theConfigureGenesisDebugExport
method is implemented correctly for theInterchainAccountsGroupsTestSuite
to facilitate Genesis file debugging.e2e/tests/upgrades/genesis_test.go (1)
32-34
: Confirm that theConfigureGenesisDebugExport
method is correctly implemented for theGenesisTestSuite
to enable Genesis file debugging.e2e/tests/interchain_accounts/params_test.go (1)
34-36
: LGTM! Ensure that the integration and functionality of the Genesis file dumping feature are verified through additional testing.e2e/tests/transfer/authz_test.go (1)
26-28
: LGTM! The addition ofConfigureGenesisDebugExport
before running the test suite is a good practice for setting up test configurations, especially for debugging purposes.e2e/tests/interchain_accounts/upgrades_test.go (1)
32-34
: LGTM! The addition ofConfigureGenesisDebugExport
before running the test suite is a good practice for setting up test configurations, especially for debugging purposes.e2e/tests/interchain_accounts/incentivized_test.go (1)
31-33
: LGTM! The addition ofConfigureGenesisDebugExport
before running the test suite is a good practice for setting up test configurations, especially for debugging purposes.e2e/tests/transfer/upgrades_test.go (1)
24-26
: The addition ofConfigureGenesisDebugExport
before running the test suite is appropriate for enabling Genesis file dumping for debugging purposes. Ensure that this new setup integrates well with the existing test suite and does not introduce any side effects.e2e/tests/interchain_accounts/localhost_test.go (1)
33-35
: The addition ofConfigureGenesisDebugExport
before running the test suite is appropriate for enabling Genesis file dumping for debugging purposes. Ensure that this new setup integrates well with the existing test suite and does not introduce any side effects.e2e/tests/transfer/base_test.go (1)
28-30
: LGTM! The addition ofConfigureGenesisDebugExport
before running the test suite ensures that Genesis file dumping is configured correctly for debugging purposes.e2e/tests/interchain_accounts/base_test.go (1)
39-41
: LGTM! The addition ofConfigureGenesisDebugExport
before running the test suite ensures that Genesis file dumping is configured correctly for debugging purposes.e2e/testsuite/testsuite.go (3)
7-10
: The import statements foros
,path
, andtesting
are correctly added to support the new functionality introduced in this PR.
73-112
: The logic and flow within theConfigureGenesisDebugExport
function are correctly implemented to configure the environment for Genesis file export based on the test configuration.
102-111
: The setting of environment variablesEXPORT_GENESIS_FILE_PATH
andEXPORT_GENESIS_CHAIN
is correctly implemented. Ensure that the usage and purpose of these environment variables are well-documented for maintainability and clarity for other developers.e2e/tests/core/02-client/client_test.go (1)
47-49
: The addition ofConfigureGenesisDebugExport
before running the test suite is appropriate for enabling Genesis file dumping for debugging. Ensure that this function does not inadvertently alter test behavior when Genesis file dumping is not enabled.e2e/testsuite/testconfig.go (3)
71-77
: The addition ofdefaultGenesisExportPath
anddefaultChainNames
provides sensible defaults for the Genesis file dumping feature and chain naming, respectively. These are straightforward and support the new functionality well.
173-200
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [176-260]
The addition of
GetChainIndex
,validateGenesisDebugConfig
,GetChainName
, andGetGenesisChainName
methods enhances the test suite's configuration capabilities, especially for the new Genesis file dumping feature. Ensure that appropriate error handling is implemented forGetChainIndex
to manage cases where an invalid chain name is provided.
280-302
: > 📝 NOTEThis review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [271-292]
The introduction of a
Name
field in theChainConfig
struct and the creation of theGenesisDebugConfig
struct are key enhancements for supporting the Genesis file dumping feature. It's recommended to document the expected format or constraints for theExportFilePath
inGenesisDebugConfig
to guide users in configuring this feature correctly.e2e/tests/transfer/incentivized_test.go (1)
35-36
: The addition of theConfigureGenesisDebugExport
method call before running the test suite is correctly placed and aligns with the PR's objectives to enable Genesis file dumping for debugging purposes.e2e/tests/upgrades/upgrade_test.go (1)
50-52
: Ensure that the behavior of the test suite remains consistent when Genesis file dumping is not enabled or when the environment variables controlling this feature are not set.
e2e/testsuite/testsuite.go
Outdated
if exportPath == "" { | ||
e2eDir, err := diagnostics.GetE2EDir(t) | ||
if err != nil { | ||
s.Fail("can't get e2edir: %w", err) |
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.
Consider using s.Require().NoError(err)
instead of s.Fail
for error handling to immediately halt the test execution upon encountering an error, ensuring cleaner test failures and avoiding potential subsequent errors.
- s.Fail("can't get e2edir: %w", err)
+ s.Require().NoError(err, "can't get e2edir")
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
s.Fail("can't get e2edir: %w", err) | |
s.Require().NoError(err, "can't get e2edir") |
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.
Thank you kind rabbit!
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.
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.
Actionable comments posted: 0
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.
Actionable comments posted: 0
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.
Actionable comments posted: 0
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (2)
- e2e/testsuite/testconfig.go (7 hunks)
- e2e/testsuite/testsuite.go (2 hunks)
Files skipped from review as they are similar to previous changes (2)
- e2e/testsuite/testconfig.go
- e2e/testsuite/testsuite.go
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, we can hold off on merging in case the test failures are related (I don't think they are 🤔 )
e2e/testsuite/testsuite.go
Outdated
|
||
// If no path is provided, use the default (e2e/diagnostics/genesis.json). | ||
if exportPath == "" { | ||
e2eDir, err := diagnostics.GetE2EDir(s.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.
Might be worth moving this to an e2e/internal
instead of diagnostics
? Since it's being used elsewhere now, I think either is probably fine though.
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.
Good point, done!
exportPath = gopath.Join(wd, exportPath) | ||
} | ||
|
||
t.Setenv("EXPORT_GENESIS_FILE_PATH", exportPath) |
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 add a link to interchaintest code for where this is used
e2e/testsuite/testconfig.go
Outdated
@@ -68,8 +68,14 @@ const ( | |||
// defaultConfigFileName is the default filename for the config file that can be used to configure | |||
// e2e tests. See sample.config.yaml as an example for what this should look like. | |||
defaultConfigFileName = ".ibc-go-e2e-config.yaml" | |||
|
|||
// defaultGenesisExportPath is the default path to which Genesis debug files will be exported to. | |||
defaultGenesisExportPath = "diagnostics/genesis.json" |
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.
if we end up moving the GetE2EPath to internal, maybe we can move this constant there too.
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.
Actionable comments posted: 1
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (4)
- e2e/internal/directories/directories.go (1 hunks)
- e2e/testsuite/diagnostics/diagnostics.go (3 hunks)
- e2e/testsuite/testconfig.go (7 hunks)
- e2e/testsuite/testsuite.go (3 hunks)
Files skipped from review as they are similar to previous changes (3)
- e2e/testsuite/diagnostics/diagnostics.go
- e2e/testsuite/testconfig.go
- e2e/testsuite/testsuite.go
Additional comments not posted (1)
e2e/internal/directories/directories.go (1)
14-15
: Introduce a configurable path for Genesis file export.While having a default path (
diagnostics/genesis.json
) for Genesis file exports is a good practice, it might be beneficial to allow this path to be configurable through environment variables or test configuration. This would provide flexibility in specifying the output directory based on different testing environments or requirements.
e2e/testsuite/testsuite.go
Outdated
@@ -4,6 +4,8 @@ import ( | |||
"context" | |||
"errors" | |||
"fmt" | |||
"os" | |||
gopath "path" |
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.
any reason why an alias was chosen here?
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.
Good catch and yes! The reason is that at line 175 we have a function that uses a variable named path, and this made the linter sad :(
Of course, now that I think about it, I could have easily just changed the variable instead, which is probably cleaner. WDYT?
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.
No super strong opinion but I'd go with changing the var name personally. Prefer to keep the stdlib imports as unaliased as possible 😄
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.
Done!
Head branch was pushed to by a user without write access
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, left one tangible q just to make sure I'm understanding the flow correctly
e2e/testsuite/testsuite.go
Outdated
@@ -67,6 +70,49 @@ func newPath(chainA, chainB ibc.Chain) pathPair { | |||
} | |||
} | |||
|
|||
func (s *E2ETestSuite) SetupTest() { | |||
s.ConfigureGenesisDebugExport() |
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 basically means we'll run these per test yea? Is this expected behavior?
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, basically just a way to make sure that env vars get set for each specific test based on the config.
e2e/testsuite/testsuite.go
Outdated
} | ||
|
||
// ConfigureGenesisDebugExport sets, if needed, env variables to enable exporting of Genesis debug files. | ||
func (s *E2ETestSuite) ConfigureGenesisDebugExport() { |
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.
looking now, I think we can make this unexported actually, should never have as need for this outside of this testsuite.
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.
Done!
Co-authored-by: DimitrisJim <[email protected]>
Co-authored-by: Nikolas De Giorgis <[email protected]> Co-authored-by: Cian Hatton <[email protected]> Co-authored-by: DimitrisJim <[email protected]>
Description
Adds new fields in the e2e config to enable dumping of Genesis files.
closes: #6032
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.Summary by CodeRabbit
getE2EDir
toGetE2EDir
indiagnostics.go
for consistent naming.testconfig.go
.diagnostics.go
for better clarity.