Test Mode and Test Provider
Topograph test mode uses the test provider to simulate topology-generation responses without querying a cloud API, NetQ, InfiniBand fabric, or Kubernetes labels. It is intended for integration and regression testing of downstream components that consume Topograph output.
Use test mode when you need to verify how a client handles successful topology generation, delayed topology generation, unknown request IDs, malformed requests, and simulated provider failures. This is especially useful for preventing regressions where an unhandled Topograph error causes a downstream system to discard a previously valid topology configuration.
Run Topograph in Test Mode
Set the default provider to test in topograph-config.yaml, and choose the engine whose output your client consumes:
Then start Topograph:
You can also leave the global provider and engine unset and specify them in each /v1/generate request payload. This is useful when one regression suite needs to exercise multiple engines.
Model files can be referenced by basename, such as small-tree.yaml, to load one of the embedded fixtures from tests/models/. You can also provide an absolute or relative path to a YAML model file.
API Flow
Topology generation uses two API endpoints.
/v1/generate
POST /v1/generate starts a topology-generation request.
Possible responses:
/v1/topology
GET /v1/topology?uid=<request-id> retrieves the result for a previously accepted request.
Possible responses:
Topograph internally retries topology processing up to 5 attempts, with exponential backoff starting at 2 seconds, for these retryable HTTP status codes:
408 Request Timeout429 Too Many Requests500 Internal Server Error502 Bad Gateway503 Service Unavailable504 Gateway Timeout
While those internal retries are running, /v1/topology continues to return 202 Accepted for the request ID.
Request Payload
The test provider is configured through provider.params in the /v1/generate request:
The engine object follows the normal Topograph engine configuration. For example, use slurm parameters to request topology/tree or topology/block output, use k8s parameters to write node labels, or use slinky parameters to update a Slinky ConfigMap.
Test Provider Parameters
Processing Behavior
When /v1/generate receives a request for provider test, Topograph decodes the test parameters before putting the request into the async queue.
- If
generateResponseCodeis between400and599, Topograph immediately returns that status code anderrorMessage. - If
generateResponseCodeis202, Topograph accepts the request and returns a request ID. - If
generateResponseCodeis any other value, Topograph returns400 Bad Request.
For accepted requests, /v1/topology behaves like the normal asynchronous Topograph flow.
- If the request ID is unknown, Topograph returns
404 Not Found. - If the request is still waiting for
requestAggregationDelayto expire, or is still processing, Topograph returns202 Accepted. - If
topologyResponseCodeis202, Topograph keeps returning202 Acceptedafter processing. This simulates a topology request that never completes. - If
topologyResponseCodeis between400and599, Topograph returns that status code anderrorMessageafter processing. Retryable codes are retried internally first. - If
topologyResponseCodeis200, Topograph loads the requested model, translates it through the selected engine, and returns the generated output.
Examples
Successful Topology Discovery
Expected behavior:
/v1/generatereturns202 Acceptedwith a request ID./v1/topologyreturns202 Accepteduntil the aggregation delay and processing complete./v1/topologythen returns200 OKwith the generated Slurm topology configuration.
Generate Request Failure
Expected behavior:
/v1/generatereturns500 Internal Server Error.- No request ID is created.
- The client should not call
/v1/topologyfor this request.
Topology Request Failure
Expected behavior:
/v1/generatereturns202 Acceptedwith a request ID./v1/topologyreturns202 Acceptedwhile the request is queued and while Topograph performs its internal retries./v1/topologyeventually returns408 Request Timeoutwith the configured error message.
Curl Workflow
Save a test payload to payload.json, submit it, and poll the result:
For ready-made regression payloads, see tests/integration/ and tests/payloads/.