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