-
Notifications
You must be signed in to change notification settings - Fork 656
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
Merged
Merged
Changes from 14 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
65a41e2
First test to export genesis debug files
bznein c6266ac
Allow for configuration on chainName and genesis debug info
bznein 9899bf4
Better path handling - and linting
bznein 7f44b73
Extend config to everything
bznein a324846
Merge branch 'main' into e2e-genesis
bznein f55d53f
Linter
bznein f8f097b
Default for chain names.
bznein 934e2f0
Revert local hack
bznein fe24e23
Linter
bznein 8434b70
Default genesis chain name
bznein 8a02d35
Use genesischainame when validating
bznein b9d9841
Added comment.
bznein 3a78f8c
Comments
bznein 06795b2
Use s.Require().NoError() instead of s.Fail()
bznein 1cd3073
Rename import
bznein 64b98a6
Merge branch 'main' into e2e-genesis
bznein c8cc6b3
Moved init logic into SetupTest
a46ca74
Moved init logic into SetupTest
d37b961
Missed one revert
bznein 3fb3d57
Merge branch 'main' into e2e-genesis
bznein 0261a22
Refactoring.
bznein 63db86c
PR Feedback
bznein a6a6322
Merge branch 'main' into e2e-genesis
chatton ecd0186
Merge branch 'main' into e2e-genesis
bznein 7d4b8d5
Small refactoring.
bznein e6f5512
Fix typo in comment
bznein 7c16d6b
Merge branch 'main' into e2e-genesis
bznein 495964b
Merge branch 'main' into e2e-genesis
bznein d39df3b
Merge branch 'main' into e2e-genesis
bznein ed2fcc9
Merge branch 'main' into e2e-genesis
chatton c1a77c5
Merge branch 'main' into e2e-genesis
bznein d6bbd8e
Merge branch 'main' into e2e-genesis
bznein eba5cbc
Merge branch 'main' into e2e-genesis
bznein 35e3f74
Rename path variable and un-alias path import.
bznein e303ca0
Fix missing rename
bznein c199f76
Merge branch 'main' into e2e-genesis
bznein 0846468
Update e2e/testsuite/testsuite.go
bznein f70c7d9
Unexport method.
bznein File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,10 @@ | |
"context" | ||
"errors" | ||
"fmt" | ||
"os" | ||
"path" | ||
"strings" | ||
"testing" | ||
|
||
dockerclient "github.com/docker/docker/client" | ||
interchaintest "github.com/strangelove-ventures/interchaintest/v8" | ||
|
@@ -67,6 +70,43 @@ | |
} | ||
} | ||
|
||
// ConfigureGenesisDebugExport sets, if needed, env variables to enable exporting of Genesis debug files. | ||
func (s *E2ETestSuite) ConfigureGenesisDebugExport(t *testing.T) { | ||
t.Helper() | ||
tc := LoadConfig() | ||
cfg := tc.DebugConfig.GenesisDebug | ||
if !cfg.DumpGenesisDebugInfo { | ||
return | ||
} | ||
|
||
// Set the export path. | ||
exportPath := cfg.ExportFilePath | ||
|
||
// If no path is provided, use the default (e2e/diagnostics/genesis.json). | ||
if exportPath == "" { | ||
e2eDir, err := diagnostics.GetE2EDir(t) | ||
s.Require().NoError(err, "can't get e2edir") | ||
exportPath = path.Join(e2eDir, defaultGenesisExportPath) | ||
} | ||
|
||
if !path.IsAbs(exportPath) { | ||
wd, err := os.Getwd() | ||
s.Require().NoError(err, "can't get working directory") | ||
exportPath = path.Join(wd, exportPath) | ||
} | ||
|
||
t.Setenv("EXPORT_GENESIS_FILE_PATH", exportPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe add a link to interchaintest code for where this is used |
||
|
||
chainIdx, err := tc.GetChainIndex(cfg.ChainName) | ||
if err != nil { | ||
s.Fail(err.Error()) | ||
} | ||
// Interchaintest adds a suffix (https://github.com/strangelove-ventures/interchaintest/blob/a3f4c7bcccf1925ffa6dc793a298f15497919a38/chainspec.go#L125) | ||
// to the chain name, so we need to do the same. | ||
genesisChainName := fmt.Sprintf("%s-%d", cfg.ChainName, chainIdx+1) | ||
t.Setenv("EXPORT_GENESIS_CHAIN", genesisChainName) | ||
} | ||
|
||
// GetRelayerUsers returns two ibc.Wallet instances which can be used for the relayer users | ||
// on the two chains. | ||
func (s *E2ETestSuite) GetRelayerUsers(ctx context.Context, chainOpts ...ChainOptionConfiguration) (ibc.Wallet, ibc.Wallet) { | ||
|
@@ -173,7 +213,7 @@ | |
|
||
// generatePathName generates the path name using the test suites name | ||
func (s *E2ETestSuite) generatePathName() string { | ||
path := s.GetPathName(s.pathNameIndex) | ||
s.pathNameIndex++ | ||
return path | ||
} | ||
|
@@ -219,7 +259,7 @@ | |
s.paths = map[string]pathPair{} | ||
} | ||
|
||
path, ok := s.paths[s.T().Name()] | ||
if ok { | ||
return path.chainA, path.chainB | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.