3
3
4
4
set -e # exit on any failure
5
5
6
- # add 18 zeros to a number
7
- to_wei () { echo " ${1} 000000000000000000" ; }
8
- to_json () { ruby -ryaml -rjson -e " puts YAML::load(STDIN.read).to_json" ; }
9
-
10
6
BASEDIR=$( pwd) /$( dirname $0 ) /../..
11
- NETWORKDIR=$BASEDIR /deploy/networks
12
7
13
- envexportfile=$BASEDIR /test/integration/vagrantenv.sh
8
+ . ${BASEDIR} /test/integration/shell_utilities.sh
9
+
10
+ export envexportfile=$BASEDIR /test/integration/vagrantenv.sh
14
11
rm -f $envexportfile
15
12
16
13
export CONTAINER_NAME=" integration_sifnode1_1"
17
14
echo " export CONTAINER_NAME=$CONTAINER_NAME " >> $envexportfile
18
15
19
16
echo " export BASEDIR=$BASEDIR " >> $envexportfile
20
17
18
+ NETWORKDIR=$BASEDIR /deploy/networks
19
+ echo " export NETWORKDIR=$NETWORKDIR " >> $envexportfile
20
+
21
21
#
22
22
# Remove prior generations Config
23
23
#
24
- echo " apologies for this sudo, it is to delete non-persisent cryptographic keys that usually has enhanced permissions"
25
- sudo rm -rf $NETWORKDIR && mkdir $NETWORKDIR
24
+ rm -rf $NETWORKDIR && mkdir $NETWORKDIR
26
25
rm -rf ${BASEDIR} /smart-contracts/build ${BASEDIR} /smart-contracts/.openzeppelin
27
26
make -C ${BASEDIR} install
28
27
@@ -31,15 +30,14 @@ cd $BASEDIR/smart-contracts
31
30
32
31
# Startup ganache-cli (https://github.com/trufflesuite/ganache)
33
32
33
+ cp $BASEDIR /test/integration/.env.ciExample .env
34
+
34
35
yarn --cwd $BASEDIR /smart-contracts install
35
36
export YARN_CACHE_DIR=$( yarn cache dir)
36
37
echo " export YARN_CACHE_DIR=$YARN_CACHE_DIR " >> $envexportfile
37
38
38
-
39
39
docker-compose --project-name genesis -f $BASEDIR /test/integration/docker-compose-ganache.yml up -d --force-recreate
40
40
41
- cp $BASEDIR /test/integration/.env.ciExample .env
42
-
43
41
# https://www.trufflesuite.com/docs/truffle/overview
44
42
# and note that truffle migrate and truffle deploy are the same command
45
43
truffle compile
@@ -63,47 +61,10 @@ if [ -z "BRIDGE_BANK_ADDRESS" ]; then
63
61
fi
64
62
echo " export BRIDGE_BANK_ADDRESS=$BRIDGE_BANK_ADDRESS " >> $envexportfile
65
63
66
- #
67
- # scaffold and boot the dockerized localnet
68
- #
69
- BASEDIR=${BASEDIR} rake genesis:network:scaffold[' localnet' ]
70
- # see deploy/rake/genesis.rake for the description of the args to genesis:network:boot
71
- # :chainnet, :eth_bridge_registry_address, :eth_keys, :eth_websocket
72
- BASEDIR=${BASEDIR} rake genesis:network:boot[" localnet,${ETHEREUM_CONTRACT_ADDRESS} ,c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3,ws://192.168.2.6:7545/" ]
73
-
74
- sleep 15
75
-
76
- #
77
- # Wait for the Websocket subscriptions to be initialized (like 10 seconds)
78
- #
79
- docker logs -f ${CONTAINER_NAME} | grep -m 1 " Subscribed"
64
+ ADD_VALIDATOR_TO_WHITELIST=1 bash ${BASEDIR} /test/integration/setup_sifchain.sh && . $envexportfile
80
65
81
- # We need to forward the port used by ganache, since adding new network didn't allow
82
- # using the cli
83
- docker exec ${CONTAINER_NAME} bash -c " bash /test/integration/start-ganache-port-forwarding.sh"
84
66
docker exec ${CONTAINER_NAME} bash -c " cd /smart-contracts && yarn install"
85
67
86
- # those rake commands generate yaml that provides useful usernames and passwords
87
- # wait for it to appear
88
-
89
- NETDEF=$NETWORKDIR /network-definition.yml
90
- echo " export NETDEF=$NETDEF " >> $envexportfile
91
- while [ ! -f $NETWORKDIR /network-definition.yml ]
92
- do
93
- sleep 2
94
- done
95
-
96
- export MONIKER=$( cat ${NETWORKDIR} /network-definition.yml | to_json | jq ' .[0].moniker' )
97
- echo " export MONIKER=$MONIKER " >> $envexportfile
98
- export MONIKER_ADDR=$( cat ${NETWORKDIR} /network-definition.yml | to_json | jq ' .[0].moniker' )
99
- echo " export MONIKER=$MONIKER " >> $envexportfile
100
-
101
- OWNER_PASSWORD=$( cat $NETDEF | yq r - " .password" )
102
- echo " export OWNER_PASSWORD=$OWNER_PASSWORD " >> $envexportfile
103
-
104
- OWNER_ADDR=$( cat $NETDEF | yq r - " .address" )
105
- echo " export OWNER_ADDR=$OWNER_ADDR " >> $envexportfile
106
-
107
68
#
108
69
# Add keys for a second account to test functions against
109
70
#
@@ -116,11 +77,16 @@ echo "export USER1ADDR=$USER1ADDR" >> $envexportfile
116
77
# Run the python tests
117
78
#
118
79
echo run python tests
80
+
119
81
docker exec ${CONTAINER_NAME} bash -c " . /test/integration/vagrantenv.sh; cd /sifnode; SMART_CONTRACTS_DIR=/smart-contracts python3 /test/integration/initial_test_balances.py /network-definition.yml"
120
- sleep 15
82
+ sleep 5
121
83
docker exec ${CONTAINER_NAME} bash -c " . /test/integration/vagrantenv.sh; cd /sifnode; SMART_CONTRACTS_DIR=/smart-contracts python3 /test/integration/peggy-basic-test-docker.py /network-definition.yml"
122
84
docker exec ${CONTAINER_NAME} bash -c ' . /test/integration/vagrantenv.sh; cd /sifnode; SMART_CONTRACTS_DIR=/smart-contracts python3 /test/integration/peggy-e2e-test.py /network-definition.yml'
123
85
124
- # killing script will not end network use stop-integration-env.sh for that
125
- # and note that we just allow the github actions environment to be cleaned
126
- # up by their scripts
86
+ # Uncomment these tests in PR 378
87
+ # Rebuild sifchain, but this time don't use validators
88
+
89
+ # sudo rm -rf $NETWORKDIR && mkdir $NETWORKDIR
90
+ # ADD_VALIDATOR_TO_WHITELIST= bash ${BASEDIR}/test/integration/setup_sifchain.sh && . $envexportfile
91
+ #
92
+ # docker exec ${CONTAINER_NAME} bash -c ". /test/integration/vagrantenv.sh; cd /sifnode; SMART_CONTRACTS_DIR=/smart-contracts python3 /test/integration/no_whitelisted_validators.py /network-definition.yml"
0 commit comments