-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Feature/init option #243
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
Feature/init option #243
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bfd4ce9
added init option flag and tests
ab8505d
init options tests
dd68d34
init option changelog
eae60ce
added sep string var properly
rigelrozanski 748a1e9
init --option can now use json
rigelrozanski 4ac089f
json testing, addressed init option PR comments
rigelrozanski 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,43 @@ | ||
| #!/bin/bash | ||
|
|
||
| CLIENT_EXE=basecli | ||
| SERVER_EXE=basecoin | ||
|
|
||
| test01initOption() { | ||
| BASE=~/.bc_init_test | ||
| rm -rf "$BASE" | ||
| mkdir -p "$BASE" | ||
|
|
||
| SERVE_DIR="${BASE}/server" | ||
| GENESIS_FILE=${SERVE_DIR}/genesis.json | ||
| HEX="deadbeef1234deadbeef1234deadbeef1234aaaa" | ||
|
|
||
| ${SERVER_EXE} init ${HEX} --home="$SERVE_DIR" -p=app1/key1/val1 -p='"app2/key2/{""name"": ""joe"", ""age"": ""100""}"' >/dev/null | ||
| if ! assertTrue "line=${LINENO}" $?; then return 1; fi | ||
|
|
||
| OPTION1KEY=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[2]') | ||
| OPTION1VAL=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[3]') | ||
| OPTION2KEY=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[4]') | ||
| OPTION2VAL=$(cat ${GENESIS_FILE} | jq '.app_options.plugin_options[5]') | ||
| OPTION2VALEXPECTED=$(echo '{"name": "joe", "age": "100"}' | jq '.') | ||
|
|
||
| assertEquals "line=${LINENO}" '"app1/key1"' $OPTION1KEY | ||
| assertEquals "line=${LINENO}" '"val1"' $OPTION1VAL | ||
| assertEquals "line=${LINENO}" '"app2/key2"' $OPTION2KEY | ||
| assertEquals "line=${LINENO}" "$OPTION2VALEXPECTED" "$OPTION2VAL" | ||
| } | ||
|
|
||
| test02runServer() { | ||
| # Attempt to begin the server with the custom genesis | ||
| SERVER_LOG=$BASE/${SERVER_EXE}.log | ||
| startServer $SERVE_DIR $SERVER_LOG | ||
| } | ||
|
|
||
| oneTimeTearDown() { | ||
| quickTearDown | ||
| } | ||
|
|
||
| # load and run these tests with shunit2! | ||
| CLI_DIR=$GOPATH/src/github.com/cosmos/cosmos-sdk/tests/cli | ||
| . $CLI_DIR/common.sh | ||
| . $CLI_DIR/shunit2 | ||
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.
nice test that it writes the values. however, it would be good to make sure it started up and could parse this file.
i guess at least using
jqto check the genesis file ensures it is proper json, but still, maybe just start the basecoin server and make sure it doesn't return an 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.
added