| .. | ||
| cluster | ||
| configs | ||
| console | ||
| greenlight | ||
| scripts | ||
| stack | ||
| .gitignore | ||
| cluster-srv.js | ||
| cluster-test.js | ||
| cluster.sql | ||
| package.json | ||
| README.md | ||
| Sphinx-Test-2.polar.zip | ||
| test.md | ||
testing
E2E
Because there are many moving parts involved in the sphinx stack, most testing for relay is done in a pseudo-e2e environment. The easiest way to develop and test sphinx relay is by running a sphinx-stack which will spin up a full regtest network and sphinx components ontop of it. There are tests that can be run against sphinx-stack available in the electron desktop app.
Follow the instructions in the sphinx stack repo for more information.
Integration tests
Some of the components in relay have integration tests written for them. These similarly require a running test network. To setup your environment and run these tests, follow these instructions:
Setup
(these instructions assume you're developing in sphinx-relay and want to test against your changes)
- Spin up a
no-aliceversion of sphinx stack by runningdocker-compose -f ./alts/no-alice.yml --project-directory . up -din that repo - Update the configs
/testing/stack/alice.jsonand/testing/stack/alice-db.jsonto point to your sphinx-stack repo's alice configs, namely for tls cert, macaroon, and db storage values - In the sphinx-relay repo, run
npm run build -- --watchto watch for changes in the repo and rebuild. - In another terminal session run the relay server, pointing to the stack configs:
node ./dist/app.js --config="testing/stack/alice.json" --db="testing/stack/alice-db.json"(run withnodemonto automatically rerun on code changes) - Wait until the
sphinx-stack/relay/NODES.jsonhas been loaded up with the network's relay nodes' details. Most importantly we want theauthTokens. This is triggered by your relay node pinging the network. - When the configs are loaded up, copy the contents of
sphinx-stack/relay/NODES.jsonand paste tosphinx-relay/src/tests/configs/nodes.json
Run tests
Once you've done the above, you can run the tests with ava.
npm run test
The tests expect both the relay server and sphinx-stack from the setup steps above to be running.