[test] Add Node API test scripts

* Make debug.sh build dynamically for faster iteration
* Refactor deploy.sh build trigger
* Add go test script to test within docker image
pull/3237/head
Daniel Van Der Maden 4 years ago
parent bb96d8e73f
commit 0e94a927e8
  1. 5
      test/all.sh
  2. 27
      test/api.sh
  3. 4
      test/debug.sh
  4. 25
      test/deploy.sh
  5. 4
      test/go.sh

@ -0,0 +1,5 @@
#!/usr/bin/env bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
bash "$DIR/kill_node.sh"
docker pull harmonyone/localnet-test
docker run -it --expose 9000-9999 -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test

@ -0,0 +1,27 @@
#!/usr/bin/env bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
bash "$DIR/kill_node.sh"
docker_name="harmony-localnet-test"
case ${1} in
run)
docker pull harmonyone/localnet-test
docker rm "$docker_name"
docker run -it --name "$docker_name" --expose 9000-9999 -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -n -k
;;
attach)
docker exec -it "$docker_name" /bin/bash
;;
*)
echo "
Node API tests
Param: Help:
run Run the Node API tests
attach Attach onto the Node API testing docker image for inspection
"
exit 0
;;
esac

@ -1,6 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
./test/kill_node.sh ./test/kill_node.sh
rm -rf tmp_log* rm -rf tmp_log*
rm *.rlp rm *.rlp
rm -rf .dht* rm -rf .dht*
./test/deploy.sh -D 600000 ./test/configs/local-resharding.txt scripts/go_executable_build.sh -S || exit 1 # dynamic builds are faster for debug iteration...
./test/deploy.sh -B -D 600000 ./test/configs/local-resharding.txt

@ -18,16 +18,18 @@ function cleanup() {
} }
function build() { function build() {
pushd ${ROOT} if [[ "${NOBUILD}" != "true" ]]; then
export GO111MODULE=on pushd ${ROOT}
if [[ "$OS" == "Darwin" ]]; then export GO111MODULE=on
# MacOS doesn't support static build if [[ "$OS" == "Darwin" ]]; then
scripts/go_executable_build.sh -S # MacOS doesn't support static build
else scripts/go_executable_build.sh -S
# Static build on Linux platform else
scripts/go_executable_build.sh -s # Static build on Linux platform
scripts/go_executable_build.sh -s
fi
popd
fi fi
popd
} }
function setup() { function setup() {
@ -41,9 +43,7 @@ function setup() {
cleanup cleanup
# Note that the binarys only works on MacOS & Linux # Note that the binarys only works on MacOS & Linux
if [[ "${NOBUILD}" != "true" ]]; then build
build
fi
# Create a tmp folder for logs # Create a tmp folder for logs
t=$(date +"%Y%m%d-%H%M%S") t=$(date +"%Y%m%d-%H%M%S")
@ -156,6 +156,7 @@ SHARDS=2
DRYRUN= DRYRUN=
NETWORK=localnet NETWORK=localnet
VERBOSE=false VERBOSE=false
NOBUILD=false
while getopts "hD:m:s:nBN:v" option; do while getopts "hD:m:s:nBN:v" option; do
case ${option} in case ${option} in

@ -0,0 +1,4 @@
#!/usr/bin/env bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
docker pull harmonyone/localnet-test
docker run -it -v "$DIR/../:/go/src/github.com/harmony-one/harmony" harmonyone/localnet-test -- -g
Loading…
Cancel
Save