Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
also much better startup scripts.
  • Loading branch information
arichnad committed Jan 13, 2014
1 parent a3fc9ae commit 52648ba
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vagrant/
stack/system-tests.properties
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ Note: these scripts require you to hit CTRL-C *twice* to exit them.

You might want to put something like this in your crontab: `@reboot cd ~/CHECKOUT-DIRECTORY/ && ./up.sh >/dev/null 2>&1`

System tests
------------

* `./enable-system-tests.sh` before running anything.
* After the system boots and the blockchain is downloaded, the system tests will automatically run.
* Run something like this: `vagrant ssh -c 'tail startup-watcher.txt'`
* Whether or not you enabled system tests before startup, you can always use `./enable-system-tests.sh` and `./run-system-tests.sh` after the system is done downloading the blockchain (`./watch-startup.sh`)


Starting over
-------------

Expand Down
14 changes: 14 additions & 0 deletions enable-system-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

FILE=stack/system-tests.properties

echo enabling system tests
echo to turn off, delete this file: $FILE

cat >"$FILE" <<END
#use "yes" or "no"
SYSTEM_TESTS_ENABLED=yes
END

4 changes: 4 additions & 0 deletions run-system-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

vagrant ssh -c './run-system-tests.sh'

34 changes: 34 additions & 0 deletions stack/run-system-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

SYSTEM_TESTS_ENABLED=no

[[ -r system-tests.properties ]] && source system-tests.properties

if [[ "$SYSTEM_TESTS_ENABLED" = "yes" ]]; then
echo system tests are enabled
else
echo system tests are disabled
exit 0
fi

function failure() {
echo SYSTEM TESTS FAILED: $@
exit 1
}

echo add_color_set
curl --silent 'http://localhost:2750/add_color_set/obc:d6bb09f56243f0e43094aa44f48d42f773763ee411bee8e1e4faa9ac03157056:0:0,obc:b1586cd10b32f78795b86e9a3febe58dcb59189175fad884a7f4a6623b77486e:0:0/orange,yellow' |
grep --quiet 'd2c626205c7e6576230beb705536b6b1bd46aa3bdfd61cbcb51b8e9eba525556' ||
failure 'add_color_set expected to see d2c6'

echo get_color_set
curl --silent 'http://localhost:2750/get_color_set/d2c626205c7e6576230beb705536b6b1bd46aa3bdfd61cbcb51b8e9eba525556' |
grep --quiet 'd6bb09f56243f0e43094aa44f48d42f773763ee411bee8e1e4faa9ac03157056' ||
failure 'get_color_set d2c6 expected to see d6bb'



echo SYSTEM TESTS SUCCEEDED



30 changes: 22 additions & 8 deletions stack/startup-watcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@

exec 2>&1 >>~/startup-watcher.txt

blockExplorerCount=$(wget -q -O- 'http://blockexplorer.com/q/testnet/getblockcount')

while [[ $(bitcoind getblockcount) -lt $blockExplorerCount ]]; do
echo block count: $(bitcoind getblockcount) / $blockExplorerCount
echo pinging abe
#keep pinging abe until bitcoind is caught up with block explorer
./ping-abe.sh
sleep 30
#running this twice, first is to catch up, then catch up again.

for ((i=0;i<2;i++)); do

blockExplorerCount=$(wget --output-document=- --quiet 'http://blockexplorer.com/q/testnet/getblockcount')

while [[ $(wget --output-document=- --quiet --tries=1 --timeout=2 http://localhost:2750/chain/Testnet/q/getblockcount) -lt $blockExplorerCount ]]; do
echo bitcoind block count: $(bitcoind getblockcount) / $blockExplorerCount
echo abe logfile count: $(grep '^block_tx ' ~/bitcoin-abe-color-explorer/bitcoin-abe-log.txt |tail -n1 |cut -f2 -d\ ) / $blockExplorerCount
echo abe block count: $(wget --output-document=- --quiet --tries=1 --timeout=2 http://localhost:2750/chain/Testnet/q/getblockcount) / $blockExplorerCount
echo pinging abe
#keep pinging abe until it is caught up with the blockexplorer.com
./ping-abe.sh
sleep 1m
done

done

sleep 30

echo caught up

#run the system tests:
./run-system-tests.sh


2 changes: 2 additions & 0 deletions up-first.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ vagrant ssh -c 'cp -a ~/abe.conf ~/bitcoin-abe-color-explorer/'
vagrant halt
./up.sh

echo 'you might want to run this to see the startup status: ./watch-startup.sh'

2 changes: 2 additions & 0 deletions watch-startup.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash

echo you must hit CTRL-C *twice* to exit

exec vagrant ssh -c 'tail -f ~/startup-watcher.txt'

0 comments on commit 52648ba

Please sign in to comment.