Skip to content

Replace OpenAI API with local mock server for testing - #132

Merged
tomasol merged 6 commits into
mainfrom
mock-openai-server
Feb 7, 2026
Merged

Replace OpenAI API with local mock server for testing#132
tomasol merged 6 commits into
mainfrom
mock-openai-server

Conversation

@tomasol

@tomasol tomasol commented Feb 7, 2026

Copy link
Copy Markdown
Contributor
  • Add mock-openai-server.py that returns canned responses for chat completions
  • Update Rust/Go/JS OpenAI activities to support OPENAI_API_BASE_URL env var
  • Update obelisk config files to pass OPENAI_API_BASE_URL to activities
  • Update test-e2e.sh and test-integration.sh to start mock server
  • Remove E2E_OPENAI_API_KEY and TEST_OPENAI_API_KEY from GitHub workflows

This eliminates the need for paid OpenAI API calls during CI testing.

Co-authored-by: Shelley shelley@exe.dev

tomasol and others added 6 commits February 7, 2026 20:47
- Add mock-openai-server.py that returns canned responses for chat completions
- Update Rust/Go/JS OpenAI activities to support OPENAI_API_BASE_URL env var
- Update obelisk config files to pass OPENAI_API_BASE_URL to activities
- Update test-e2e.sh and test-integration.sh to start mock server
- Remove E2E_OPENAI_API_KEY and TEST_OPENAI_API_KEY from GitHub workflows

This eliminates the need for paid OpenAI API calls during CI testing.

Co-authored-by: Shelley <shelley@exe.dev>
- Fix UnboundLocalError in mock server when JSON parsing fails
- Make mock server conditional: only start if (TEST_)OPENAI_API_KEY is not set
- Allow users to run tests against real OpenAI API by setting the env vars

Co-authored-by: Shelley <shelley@exe.dev>
OCI images are pre-built and don't have the OPENAI_API_BASE_URL support,
so they contact the real OpenAI API regardless of the env var setting.
Skip these tests when no real API key is provided.

Co-authored-by: Shelley <shelley@exe.dev>
@tomasol
tomasol merged commit 52f42fa into main Feb 7, 2026
15 of 16 checks passed
@tomasol
tomasol deleted the mock-openai-server branch February 7, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant