test(orbital_navigation): add local checker coverage
This commit is contained in:
1 parent
9182c96045
commit
9f46b00530
2 files changed
+506
No files matched your search
@@ -0,0 +1,65 @@
|
||||
# Local Orbital Navigation checker
|
||||
|
||||
`checker.py` exercises the real HTTP interface with Python's standard library.
|
||||
It uses five distinct random **synthetic** values, never a game flag. Run it
|
||||
only against an isolated local container and a separate test volume. The
|
||||
private Skipper checker is unavailable, so this is a deployment regression
|
||||
test, not a replica or proof of a scored `UP` round. Public Skipper logs show
|
||||
CHECK/PUT/GET status and duration but do not expose their internal requests.
|
||||
|
||||
## Run against a disposable container
|
||||
|
||||
From the repository root, choose a free loopback port (shown here as `18086`):
|
||||
|
||||
```sh
|
||||
TEST_ID="orbital-check-$(date +%s)-$$"
|
||||
STATE_FILE="/tmp/${TEST_ID}.json"
|
||||
docker build -t "${TEST_ID}:local" orbital_navigation
|
||||
docker volume create "${TEST_ID}-data"
|
||||
docker run -d --name "$TEST_ID" -p 127.0.0.1:18086:8080 \
|
||||
-v "${TEST_ID}-data:/data" "${TEST_ID}:local"
|
||||
|
||||
python3 orbital_navigation/tests/checker.py \
|
||||
--url http://127.0.0.1:18086 --state "$STATE_FILE" put
|
||||
docker restart "$TEST_ID"
|
||||
python3 orbital_navigation/tests/checker.py \
|
||||
--url http://127.0.0.1:18086 --state "$STATE_FILE" get
|
||||
python3 orbital_navigation/tests/checker.py \
|
||||
--url http://127.0.0.1:18086 --state "$STATE_FILE" check
|
||||
```
|
||||
|
||||
`put` refuses to overwrite an existing state file. Its atomic write creates
|
||||
the file with mode `0600`; it contains the two synthetic user tokens and the
|
||||
five markers, so keep it outside Git and do not share its contents. `get`
|
||||
reads the same records after a process restart with the same `/data` volume.
|
||||
`check` verifies cross-user denials, legitimate public geometry delegation,
|
||||
the observed `register` → `create_flight` → `grant_geometry` CHECK flow,
|
||||
package upload/approval/report, approval reset after replacement, and small
|
||||
malformed requests. It also checks a valid source alias, rejects loopback
|
||||
bulletin URLs, and re-reads the summary at the end. All commands print only
|
||||
pass/fail summaries.
|
||||
|
||||
To cover the normal `import_bulletin` → `import_result` path, start a tiny
|
||||
HTTP mock in the disposable container's network at an address that is **not**
|
||||
loopback from the service container. The service intentionally rejects
|
||||
`localhost`, `127.0.0.1`, and their aliases. Then add `--import-url` and
|
||||
`--import-contains` before `put` and `check`. `put` stores the imported content
|
||||
in its private state file; `get` confirms it still exists after restart, while
|
||||
`check` verifies a fresh import and cross-user denial. Choose a free mock port:
|
||||
Docker can already be forwarding a port even when another host process appears
|
||||
to listen on it. Keep this mock local; the service sends its importer header
|
||||
to the specified server.
|
||||
|
||||
To remove **only this disposable test instance** after finishing:
|
||||
|
||||
```sh
|
||||
docker rm -f "$TEST_ID"
|
||||
docker volume rm "${TEST_ID}-data"
|
||||
rm -f "$STATE_FILE"
|
||||
```
|
||||
|
||||
`all` runs `put`, `get`, and `check` in one process, but the separate commands
|
||||
above are needed to test old data across a restart. This checker does not
|
||||
cover the private Skipper PUT/GET choice of flag slot, the normal bulletin
|
||||
import unless a local mock URL is supplied, load limits, or the actual game
|
||||
route. Confirm live status from Skipper after any deployment.
|
||||
Reference in new issue
Block a user