/ testing.md
testing.md
1 ### Testing Instructions 2 3 #### Fedimint Guardian & Gateway UI End to End Testing Instructions 4 5 In your nix dev-shell 6 7 1. Run `just guardian` to spin up 4x guardians and UIs on ports :3000, :3001, :3002, :3003 8 2. Walk through the setup process 9 10 - PLEASE open issues for anything you run into here, this is the most important part to get right and seamless and we're always looking to streamline this setup process 11 12 3. After setup, connect the gateway with UI running on port :3004 13 4. Set up a meta for the federation 14 15 - From 1 guardian, propose a new meta with some key/values 16 - Confirm on the other guardians, once a threshold is met it will set it as the new meta 17 - Modify the meta from another guardian and propose the modifications 18 - Confirm the meta modifications on the other guardians, once a threshold is met it will set it as the new meta 19 20 6. Peg in some bitcoin to the federation. 21 22 - Pull a deposit address through the gateway UI 23 - Send to it with `bitcoin-cli sendtoaddress 1 replace-this-with-address` 24 - Mine some coins with `bitcoin-cli generatetoaddress 100 $(bitcoin-cli getnewaddress)` 25 - Confirm the coins show up in the gateway-ui wallet 26 - Confirm the coins show up in the guardian-ui balance sheet 27 28 7. Peg out some bitcoin from the federation 29 30 - get a new address with `bitcoin-cli getnewaddress` 31 - From the gateway, start a withdraw to that address 32 - Mine some coins with `bitcoin-cli generatetoaddress 100 $(bitcoin-cli getnewaddress)` 33 - Confirm the coins are out of the gateway-ui wallet 34 - Confirm the coins are off of the guardian-ui balance sheet 35 36 8. Coordinate a shutdown 37 38 - From each of the guardian UIs, go to Danger Zone and use the Coordinate Shutdown button to set a session height to shutdown at. Give it ~10 sessions from the current session height 39 - just send some coins back and forth on the gateway to keep the sessions coming until they shutdown 40 - confirm in the logs that the guardians all shut down at the same session height 41 42 #### Test Guardian API Rotation 43 44 We test this with docker so we can restart services on different ports, simulating changing DNS. 45 46 1. Start the guardians up with `just rotate`, which will pull docker images for the latest fedimint and start an mprocs with some special sauce 47 2. On each `guardian-ui` process, hit `Enter` to start on the default ports 48 3. Go through the end to end setup process for the federation 49 4. Restart the docker container: Once you're on the dashboard for all of them 50 51 - hit `r` on the `restart-guardian` process to start the docker container restart logic. 52 - Select which container you want to restart (e.g. 1 for fedimint_1) 53 - Select which port to restart on (e.g. 13333) 54 - Wait for the container to restart 55 56 5. Confirm that the corresponding UI (e.g. :3000 for fedimint_1) can't connect when you refresh the page (since the port changed) 57 6. On the corresponding UI process, hit `r` and enter the port you restarted the guardian's docker service on (e.g. 13333) 58 7. Go back to the corresponding UI in your browser: 59 60 - A modal should pop up saying you've changed the API_URL and you need to sign a new api announcement 61 - Modify the `127.0.0.1` to the container name (e.g. `ws://fedimint_1:13333` instead of `ws://127.0.0.1:13333`) 62 - Click to sign the API announcement 63 64 8. Confirm the updated API announcement reflects on the other guardians 65 9. Refresh the gateway UI and confirm that it updates to open a ws with the guardian on its new port from the new api announcement 66 10. Before committing anything, run `just reset dc` to reset the docker-compose that was modified during the api rotation testing by the scripts