Skip to content

Add gateway HTTP behavior tests - #29

Draft
binrogithub wants to merge 1 commit into
masterfrom
codex/create-tests-for-request-patches
Draft

Add gateway HTTP behavior tests#29
binrogithub wants to merge 1 commit into
masterfrom
codex/create-tests-for-request-patches

Conversation

@binrogithub

Copy link
Copy Markdown
Owner

Motivation

  • Add tests to validate gateway/runner HTTP behavior for preview and apply modes, and to ensure gateway persistence of run artifacts when a RunStore is available.
  • Ensure preview runs do not make outbound HTTP calls and still produce artifacts when run via a gateway path.
  • Ensure apply runs invoke HTTP exactly once and that run evidence is filtered to whitelisted keys.

Description

  • Add tests/test_preview_no_http.py which patches requests.request to raise an AssertionError if called, invokes a preview run via any available gateway/runner callable (e.g. hc_run/run), asserts the run result indicates success or a non-HTTP error, asserts requests.request was not called, and checks artifact files when a gateway path is used.
  • Add tests/test_apply_calls_http.py which patches requests.request to return a FakeResponse (200, X-Request-Id header, JSON payload), invokes an apply run, asserts requests.request was called once, validates presence of expected run fields (e.g. run_id/summary/envelope), and enforces evidence keys are whitelisted.
  • Add tests/test_gateway_persists_run.py which detects an available RunStore class, instantiates it pointing at a temp base dir, runs the gateway apply path, extracts the run id from the result, and asserts an artifact like runs/<run_id>/report.md exists.
  • Tests are written to discover available modules/entrypoints at runtime and to skip when required dependencies or signatures are not present; all mocking uses autotest.client.shared.test_utils.mock.
  • No external skills were used for this change.

Testing

  • No automated tests were executed as part of this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant