-
Notifications
You must be signed in to change notification settings - Fork 525
goal: Add export and import options for genesis files during network creation #5672
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ae3ad51
Add export and import options for genesis files during network creation
algochoi be0ec7d
Fix lint errors
algochoi 9cdd3d2
Add e2e test for creating genesis files
algochoi b2a5ea7
Reuse genesis files
algochoi 96ae6fb
Some UX improvements to genesis command
algochoi 196e0d1
PR comment fixes regarding UX
algochoi f97851b
Add private network tests in e2e.sh
algochoi 5af9189
Merge default consensus
algochoi 4ab1aad
Add go test for generating network
algochoi c797f87
Change command name to pregen
algochoi 0ee860d
Revert private network script test
algochoi bd49e53
Rename genesis to pregen
algochoi 5eae011
Use tempdir in tests
algochoi 0a989a2
Fix flags in testing utility
algochoi e054b23
Uncomment short test skips
algochoi a45062f
Merge branch 'master' into import-partkeys
algochoi 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright (C) 2019-2023 Algorand, Inc. | ||
| // This file is part of go-algorand | ||
| // | ||
| // go-algorand is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Affero General Public License as | ||
| // published by the Free Software Foundation, either version 3 of the | ||
| // License, or (at your option) any later version. | ||
| // | ||
| // go-algorand is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Affero General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with go-algorand. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| // Check that private networks are started as designed. | ||
| package privatenet | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/algorand/go-algorand/test/framework/fixtures" | ||
| "github.com/algorand/go-algorand/test/partitiontest" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| // TestPrivateNetworkImportKeys tests that part keys can be exported and | ||
| // imported when starting a private network. | ||
| func TestPrivateNetworkImportKeys(t *testing.T) { | ||
| partitiontest.PartitionTest(t) | ||
|
|
||
| // This test takes 5~10 seconds. | ||
|
algochoi marked this conversation as resolved.
|
||
| if testing.Short() { | ||
| t.Skip() | ||
| } | ||
|
|
||
| // First test that keys can be exported by using `goal network pregen ...` | ||
| // Don't start up network, just create genesis files. | ||
| var goalFixture fixtures.GoalFixture | ||
| tmpGenDir := t.TempDir() | ||
| tmpNetDir := t.TempDir() | ||
| defaultTemplate := "" // Use the default template by omitting the filepath. | ||
|
|
||
| _, err := goalFixture.NetworkPregen(defaultTemplate, tmpGenDir) | ||
| require.NoError(t, err) | ||
|
|
||
| // Check that if there is an existing directory with same name, test fails. | ||
| errStr, err := goalFixture.NetworkPregen(defaultTemplate, tmpGenDir) | ||
| require.Error(t, err) | ||
| require.Contains(t, errStr, "already exists and is not empty") | ||
|
|
||
| // Then try importing files from same template. | ||
| err = goalFixture.NetworkCreate(tmpNetDir, "", defaultTemplate, tmpGenDir) | ||
| require.NoError(t, err) | ||
|
|
||
| err = goalFixture.NetworkStart(tmpNetDir) | ||
| require.NoError(t, err) | ||
|
|
||
| err = goalFixture.NetworkStop(tmpNetDir) | ||
| require.NoError(t, err) | ||
| } | ||
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.