run-tests.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. set -e
  3. # Location that will be mounted as the /data volume in containers
  4. # This is how we access the initial members and balances files from
  5. # the containers and where generated chainspec files will be located.
  6. DATA_PATH=${DATA_PATH:=~/tmp}
  7. ALICE_INITIAL_BALANCE=${ALICE_INITIAL_BALANCE:=100000000}
  8. mkdir -p ${DATA_PATH}
  9. # Alice is the source of funds for all new members that are created in the tests.
  10. echo "{
  11. \"balances\":[
  12. [\"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY\", ${ALICE_INITIAL_BALANCE}]
  13. ]
  14. }" > ${DATA_PATH}/initial-balances.json
  15. # Make Alice a member
  16. echo '
  17. [{
  18. "member_id":0,
  19. "root_account":"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  20. "controller_account":"5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY",
  21. "handle":"alice",
  22. "avatar_uri":"https://alice.com/avatar.png",
  23. "about":"Alice",
  24. "registered_at_time":0
  25. }]
  26. ' > ${DATA_PATH}/initial-members.json
  27. # Create a chain spec file
  28. docker run -v ${DATA_PATH}:/data --entrypoint ./chain-spec-builder joystream/node \
  29. new \
  30. --authority-seeds Alice \
  31. --sudo-account 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY \
  32. --deployment dev \
  33. --chain-spec-path /data/chain-spec.json \
  34. --initial-balances-path /data/initial-balances.json \
  35. --initial-members-path /data/initial-members.json
  36. # Convert the chain spec file to a raw chainspec file
  37. docker run -v ${DATA_PATH}:/data joystream/node build-spec \
  38. --raw --disable-default-bootnode \
  39. --chain /data/chain-spec.json > ~/tmp/chain-spec-raw.json
  40. # Start a chain with generated chain spec
  41. docker run -v ${DATA_PATH}:/data -d -p 9944:9944 joystream/node \
  42. --validator --alice --unsafe-ws-external --rpc-cors=all --log runtime \
  43. --chain /data/chain-spec-raw.json
  44. yarn workspace network-tests test