|
| 1 | +# Testing scripts |
| 2 | + |
| 3 | +This directory contains some scripts that you can use to test the API. For them to work, you need to |
| 4 | +specify the URL of your Agama server (it might be running, for instance, on a virtual machine): |
| 5 | + |
| 6 | +``` |
| 7 | +export AGAMA_URL=https://192.168.122.10 |
| 8 | +``` |
| 9 | + |
| 10 | +## Logging in |
| 11 | + |
| 12 | +Before running any other script, you need to log into the API. You can use the `login.sh` script for |
| 13 | +that. It will generate a `headers.txt` file that contains the authentication token. By default, it |
| 14 | +uses the password `linux`, which is hardcoded into the script. |
| 15 | + |
| 16 | +``` |
| 17 | +$ ./login.sh |
| 18 | +Logging in https://192.168.122.10 |
| 19 | +Using token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3NjU2MzA2MjYsImNsaWVudF9pZCI6IjczNTJmYzFjLWVlNGItNDUzMC05NzY2LTFiMGEyODk3ZDlkZCJ9.fjkk4mab0mTEc-e3IevhKJu2pOkz6Ie0kVQD9GXZ_ZQ |
| 20 | +
|
| 21 | +``` |
| 22 | + |
| 23 | +## Setting the configuration |
| 24 | + |
| 25 | +The `set-config.sh` script allows to partially update the configuration. It receives a JSON file |
| 26 | +containing the body of the PATCH request. Check `examples/*.patch.json` for some examples. |
| 27 | + |
| 28 | +``` |
| 29 | +$ ./set-config.sh examples/tumbleweed.patch.json |
| 30 | +``` |
| 31 | + |
| 32 | +You can check the user configuration using the `get-config.sh` script. |
| 33 | + |
| 34 | +## Getting the status |
| 35 | + |
| 36 | +There are a few scripts to retrieve different aspects of the system (status, system information, |
| 37 | +configuration, etc.). Check for `get-*.sh` scripts. |
| 38 | + |
| 39 | +## Listening to events |
| 40 | + |
| 41 | +You can listen to Agama events using the `monitor-*.sh` scripts: |
| 42 | + |
| 43 | +- `monitor-websocat.sh`: it relies on [websocat](https://github.com/vi/websocat). Unfortunately, the |
| 44 | + program is not available in the official openSUSE repositories, so you might need to use |
| 45 | + `cargo install` (or `cargo binstall`). |
| 46 | +- `monitor-curl.sh`: it uses `curl` under the hood. The output is less convenient, but you do not |
| 47 | + need an extra tool (TODO: improve the `curl` invocation). |
0 commit comments