Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Build on add-integratin-tests
Browse files Browse the repository at this point in the history
* project -> truffle-project
* facilitate running the same thing outside of docker and circleci
* tweak options on standalone script. Should do on circleci as well
  • Loading branch information
rocky committed Feb 25, 2019
1 parent 818d43c commit 34b997b
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
@@ -1,4 +1,4 @@
.PHONY: test check lint lint-fix
.PHONY: test check check-integration lint lint-fix


#: Run lint and then tests
Expand All @@ -23,6 +23,10 @@ lint:
lint-fix:
npx eslint --fix --rulesdir=tools/eslint-rules lib

#: Run integration test
check-integration:
./integration-tests/run-tests.sh

RM ?= rm
GIT2CL ?= git2cl

Expand Down
7 changes: 7 additions & 0 deletions integration-tests/mythx-prod-trial
@@ -0,0 +1,7 @@
# Source this to set up to run as a trial user
unset MYTHX_API_KEY
export MYTHX_ETH_ADDRESS='0x0000000000000000000000000000000000000000'
MYTHX_API_URL=${MYTHX_API_URL:-'https://api.mythx.io'}
export MYTHX_API_URL
export MYTHX_PASSWORD='trial'
echo Set up to use MythX as trial user
37 changes: 37 additions & 0 deletions integration-tests/run-tests.sh
@@ -0,0 +1,37 @@
#!/bin/bash
# Run integration tests
me=$(readlink -f $0)
mydir=$(dirname $me)
TIME_OUT=${TIME_OUT:-360} # 6 minutes

run_test() {
set -x
truffle run verify --no-cache-lookup --debug=1 --timeout=$TIME_OUT
rc=$?
set +x
# FIXME: rc is 0 even when there is a failure - checkout output
return $rc
}

cd $mydir
. ./mythx-prod-trial
cd truffle-project

typeset -i rc

# If an account is set, try it
if [[ -n $MYTHX_ETH_ADDRESS && -n $MYTHX_PASSWORD ]] ; then
echo "Testing with $MYTH_ETH_ADDRESS..."
run_test
rc=$?
if (($rc != 0)) ; then
echo "Failed using with address $MYTH_ETH_ADDRESS"
fi
fi

typeset -i rc2
echo "Testing as trial user..."
run_test
rc2=$?
((rc=rc+rc2))
exit $rc
1 change: 1 addition & 0 deletions integration-tests/truffle-project/.gitignore
@@ -0,0 +1 @@
/build
1 change: 1 addition & 0 deletions integration-tests/truffle-project/README.md
@@ -0,0 +1 @@
This sample truffle project is used in integration testing.

0 comments on commit 34b997b

Please sign in to comment.