Skip to main content

Fauxbus

A wire-level fake of the Globus API for E2E testing.

The problem

Globus is the data fabric of research computing: it moves datasets between universities, national labs, and HPC centers, and its API is how institutions automate that world — group rosters that gate who can reach which collection, permissions, transfer pipelines. If you run research infrastructure, sooner or later you have code calling this API, and that code matters more than most: it decides who can touch the data.

Testing that code is where it gets uncomfortable. Globus has no sandbox, no emulator, no local mode. The SDK ships a testing module, but it is in-process canned responses — by its own docs "a best approximation of API responses" — which serves unit tests well and cannot back a socket. So an integration test has two options: a real tenancy (real credentials in CI, real groups with real people in them, rate limits, shared mutable state, network weather), or nothing. A lot of shops choose nothing. The layer that gates access to research data ends up the least-tested code in the pipeline, precisely because it is the riskiest thing to point a test at.

Fauxbus is a third option: a standalone HTTP server that imitates the Globus API at the wire level. Point your globus-sdk client at http://localhost:9800 instead of the real service and run your existing suite — same requests, same response shapes, same status codes. Your code never learns it isn't talking to Globus. And because the whole point of a fake is control, failure is a feature you schedule: a 429 on exactly the request where your retry logic needs exercise, an identity that is already in the group, a batch action that partially fails the way the real service partially fails.

Status: early but real. The complete GroupsClient surface of globus-sdk 4.8.1 is implemented — all fourteen methods, all eleven batch membership verbs — plus the OAuth2 client-credentials grant at POST /v2/oauth2/token, so a service can fetch a token as itself and then spend it, and the introspection and revocation endpoints that go with it, so the service on the receiving end can ask whether the token it was handed is real and the service that issued one can take it back — plus the OIDC authorization-code flow, so a real identity broker like Keycloak can sign a seeded person in through Fauxbus, linked identities and all. The conformance suite drives all of it through the actual globus-sdk, unmodified, including the SDK's retry layer recovering through an injected 429. Response shapes not yet backed by a recording are marked PROVISIONAL in code and tracked as conformance obligations. Nothing is stable yet — see SPEC.md for the full design.

Fake, not mock

Your code doesn't know Fauxbus is there. No monkeypatching, no fixture dicts shaped like your guess about what Globus returns. The client library you ship is the client library you test against — Fauxbus imitates what globus-sdk actually sends and expects, pinned to a stated SDK version and derived from real recorded responses, never guesswork.

If canned responses inside a Python unit test are all you need, use the SDK's own globus_sdk.testing — that's the in-process layer, and its fixtures are Fauxbus's ground truth. Fauxbus is for the layer it architecturally can't reach: a real socket your whole stack can talk to, with state behind it (think moto next to botocore's Stubber).

Quick start

pipx install fauxbus
fauxbus serve --port 9800

Point globus_sdk.GroupsClient(...) at that port instead of the real service host and run your existing test suite. Other Globus clients will meet honest 501s until their surfaces exist — see below.

Tokens

By default any bearer token works, and its identity is a stable function of the token string — t-alice is the same caller on every run, on every machine. That is usually what you want in a test.

When you need the real thing, register a confidential client in the seed document and fetch a token the way your service will in production:

from globus_sdk import ConfidentialAppAuthClient, AccessTokenAuthorizer, GroupsClient

auth = ConfidentialAppAuthClient(CLIENT_ID, SECRET, base_url="http://localhost:9800")
tokens = auth.oauth2_client_credentials_tokens(
    "urn:globus:auth:scope:groups.api.globus.org:all"
)
access_token = tokens.by_resource_server["groups.api.globus.org"]["access_token"]

groups = GroupsClient(base_url="http://localhost:9800",
                      authorizer=AccessTokenAuthorizer(access_token))

A Globus client is an identity, so that token acts as the client itself — create a group with it and the client shows up as its own admin, exactly as it would against the real service.

Start with --require-issued-tokens and Fauxbus stops accepting made-up tokens: it checks that a token was issued here, hasn't expired (on the logical clock — POST /_fauxbus/tick ages it, no sleeping), and is good for the service being called. Three production failures you otherwise cannot write a test for.

Brokered login (OIDC)

Seed people and a login client, give Fauxbus an issuer, and a real broker can sign someone in through it. The browser lands on a plain Fauxbus page listing the seeded accounts — no passwords, ever — picks one, and the broker gets a code, a signed ID token, and userinfo, the way it would from Globus. examples/seed.json carries a working set: alice, whose Globus ID account has a linked university identity, and a login client that requires the university provider, so she signs in as her university identity.

fauxbus serve --seed examples/seed.json --issuer http://localhost:9800 \
              --signed-token-clock wall

--signed-token-clock wall is the flag that matters. Fauxbus runs on a logical clock and never reads real time unless you ask; Keycloak checks an ID token's exp against real time and cannot be asked to tick. Without the flag, the tokens say 1970 and the login "just fails." (The example seed sets it already.)

One issuer, two names. In compose the browser reaches Fauxbus at localhost:9800 and Keycloak reaches it at fauxbus:9800. Fauxbus stamps every ID token with the configured issuer whichever name it was reached by, so give Keycloak the browser's name for the authorize URL and the issuer, and the network's name for everything else. The identity-provider settings examples/keycloak_broker.py proved against Keycloak 26.0:

Keycloak setting Value
Issuer http://localhost:9800
Authorization URL http://localhost:9800/v2/oauth2/authorize
Token URL http://fauxbus:9800/v2/oauth2/token
JWKS URL (Use JWKS URL: on) http://fauxbus:9800/jwk.json
User Info URL http://fauxbus:9800/v2/oauth2/userinfo
Client authentication Client secret as basic auth (client_secret_basic)
Validate signatures on
PKCE on, S256
Scopes openid profile email
Sync mode force

Basic auth because that is the only method the real Globus advertises; Fauxbus also accepts client_secret_post, which the real service may not. Ask for profile and email explicitly — under openid alone Globus sends no name or address, and neither does Fauxbus. Run the proof yourself with python examples/keycloak_broker.py (needs docker; cleans up after itself).

The fixture signing key is published in src/fauxbus/signing.py on purpose. Anyone can forge a Fauxbus token, so nobody can be tempted to trust one. Never configure it as a trusted issuer anywhere real — and Fauxbus refuses to run with an issuer under a Globus domain.

In a compose stack

The repo ships a Containerfile. Zero runtime dependencies means the image is the Python base plus one stdlib-only wheel — nothing else rides along. Mount a state document at /seed.json and the world exists before the first test connects:

services:
  fauxbus:
    build: { context: ., dockerfile: Containerfile }
    ports: ["9800:9800"]
    volumes: ["./seed.json:/seed.json:ro"]

Build it with --pull (docker compose build --pull), and rebuild it now and then. Fauxbus publishes no image of its own, so the base layer is whatever your builder cached the first time — and a cached base stops collecting security fixes the day it was pulled. The final stage is Alpine for a related reason: a pure-stdlib app needs little more than the interpreter, so less distro means fewer CVEs nobody can patch. CI scans every image it builds with grype and fails on anything at Medium or above that .grype.yaml hasn't acknowledged. Each ack names the exact package version it covers and why, so it lapses as soon as the package changes. Pass the same file to your own scanner (grype --config .grype.yaml) to get the same acks.

The image ships a healthcheck on the control-plane index, so depends_on: { fauxbus: { condition: service_healthy } } does the waiting for you. A runnable example — sibling-service pattern, seed file included, both round-trip tested in CI — is in examples/.

The control plane

Everything test-harness-y lives under /_fauxbus/, a prefix no Globus API will ever claim — the imitated surface stays pure. GET /_fauxbus/state dumps everything in the world for assertions; POST /_fauxbus/reset returns the world to its canonical seed (or to empty) between tests — mutate freely, reset comes home. Full control-plane surface is in SPEC.md.

It is unauthenticated by design — it imitates a service that answers the network, and harnesses are often sibling containers. Which means anyone who can reach the port can rewrite the world and arm forged responses; for a fake, the sharpest risk isn't a crash but a lie, since tests that trust it would go green when they should go red. Run it where you'd run any test fixture. On a shared host, --control-loopback-only refuses /_fauxbus/ from non-loopback peers without touching the imitated surface. The reasoning, and the two things that flag deliberately doesn't solve, are in SPEC.md.

Loud 501s, no fiction

Fauxbus only implements endpoints a real consumer needs. Anything it doesn't imitate yet returns a loud 501 with a pointer to file an issue — never a silent wrong answer pretending to be Globus. If you hit one, that's the fastest way to get it prioritized.

The source is meant to be read

Comments narrate the design decisions where they live — why uuid5 and never uuid4, why one lock, why 404 instead of 403, why failure injection can't touch the control plane — at a depth meant for someone learning how to build a wire-level fake, not just use one.

Not affiliated with Globus

Fauxbus is an independent test tool, not affiliated with or endorsed by Globus or the University of Chicago. "Globus" is their trademark; this project imitates the API's behavior for local testing only — the name is a confession, not an infringement. It's faux.

License

MIT. Fauxbus contains no Globus code: it imitates publicly documented wire behavior, grounded against the Apache-2.0 globus-sdk as a test-time dependency only.

Metadata

Release files for fauxbus 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fauxbus 0.3.0
File Size Uploaded Provenance Actions
fauxbus-0.3.0.tar.gz 176.1 kB Without provenance Details for fauxbus-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for fauxbus 0.3.0
File Interpreter ABI Platform Actions
fauxbus-0.3.0-py3-none-any.whl Python 3 none any Details for fauxbus-0.3.0-py3-none-any.whl

Total release size: 264.6 kB

Release files / fauxbus-0.3.0.tar.gz

Download URL fauxbus-0.3.0.tar.gz
Size 176.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ac0418e8e1ded9fc5e590f674ce4f13ff03e69502c51292d545386f85b2db141
BLAKE2b-256 checksum
How to use checksums
8af9d7f43db20164fdbf8e1554f3133dac01a2b605277c5932c7ea50ad4789e9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / fauxbus-0.3.0-py3-none-any.whl

Download URL fauxbus-0.3.0-py3-none-any.whl
Size 88.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e379070db792541f63dd23866a7b7fad6ef534086f64f0da0d4a2f931c9cb0f1
BLAKE2b-256 checksum
How to use checksums
efb56827503707351be7ee7bd94261e7608b535bdab39a79f1a3f77c199ca029
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for fauxbus 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page