github.com/ethereumproject/go-ethereum@v5.5.2+incompatible/tests/bats/cmd.bats (about) 1 #!/usr/bin/env bats 2 3 : ${GETH_CMD:=$GOPATH/bin/geth} 4 5 setup() { 6 DATA_DIR=`mktemp -d` 7 } 8 9 teardown() { 10 rm -fr $DATA_DIR 11 } 12 13 @test "reset command" { 14 cp -a $BATS_TEST_DIRNAME/../../cmd/geth/testdata/testdatadir/. $DATA_DIR/ 15 16 # Ensure chaindata dir exists before proof of removal. 17 [ -d $DATA_DIR/mainnet/chaindata ] 18 19 # Test with negative user response: SHOULD NOT remove chaindata/ 20 run $GETH_CMD --data-dir $DATA_DIR reset <<< $'no' 21 [ "$status" -eq 0 ] 22 [ -d $DATA_DIR/mainnet/chaindata ] 23 24 # Test with affirmative user response: SHOULD remove chaindata/ 25 run $GETH_CMD --data-dir $DATA_DIR reset <<< $'y' 26 [ "$status" -eq 0 ] 27 ! [ -d $DATA_DIR/mainnet/chaindata ] 28 }