Skip to content

Commit

Permalink
cli: fix abci help (tendermint#9717)
Browse files Browse the repository at this point in the history
* fix abci-cli help

* add test

* fix script

* debugging CI

* revert the changes for verifying CI

* update pending log

Co-authored-by: Sergio Mena <[email protected]>
  • Loading branch information
JayT106 and sergio-mena authored Nov 23, 2022
1 parent 12f0c4a commit 2d036c5
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
### BUG FIXES

- [docker] \#9462 ensure Docker image uses consistent version of Go
- [abci-cli] \#9717 fix broken abci-cli help command

## v0.37.0

Expand Down
2 changes: 1 addition & 1 deletion abci/cmd/abci-cli/abci-cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var RootCmd = &cobra.Command{
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {

switch cmd.Use {
case "kvstore", "version":
case "kvstore", "version", "help [command]":
return nil
}

Expand Down
26 changes: 26 additions & 0 deletions abci/tests/test_cli/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,34 @@ function testExample() {
rm "${INPUT}".out.new
}

function testHelp() {
INPUT=$1
APP="$2 $3"

echo "Test: $APP"
$APP &> "${INPUT}.new" &
sleep 2

pre=$(shasum < "${INPUT}")
post=$(shasum < "${INPUT}.new")

if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
echo "Got:"
cat "${INPUT}.new"
echo "Expected:"
cat "${INPUT}"
echo "Diff:"
diff "${INPUT}" "${INPUT}.new"
exit 1
fi

rm "${INPUT}".new
}

testExample 1 tests/test_cli/ex1.abci abci-cli kvstore
testExample 2 tests/test_cli/ex2.abci abci-cli kvstore
testHelp tests/test_cli/testHelp.out abci-cli help

echo ""
echo "PASS"
30 changes: 30 additions & 0 deletions abci/tests/test_cli/testHelp.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
the ABCI CLI tool wraps an ABCI client and is used for testing ABCI servers

Usage:
abci-cli [command]

Available Commands:
batch run a batch of abci commands against an application
check_tx validate a transaction
commit commit the application state and return the Merkle root hash
completion Generate the autocompletion script for the specified shell
console start an interactive ABCI console for multiple commands
deliver_tx deliver a new transaction to the application
echo have the application echo a message
help Help about any command
info get some info about the application
kvstore ABCI demo example
prepare_proposal prepare proposal
process_proposal process proposal
query query the application state
test run integration tests
version print ABCI console version

Flags:
--abci string either socket or grpc (default "socket")
--address string address of application socket (default "tcp://0.0.0.0:26658")
-h, --help help for abci-cli
--log_level string set the logger level (default "debug")
-v, --verbose print the command and results as if it were a console session

Use "abci-cli [command] --help" for more information about a command.

0 comments on commit 2d036c5

Please sign in to comment.