ai-assistant: docs: Add e2e testing guide#879
Open
illume wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new end-to-end testing guide for the ai-assistant plugin, intended to document mock providers, MCP process e2e tests, and a KWOK-based demo workflow.
Changes:
- Introduces
ai-assistant/docs/e2e-testing.mdcovering mock testing model/agent usage, MCP e2e testing, and a KWOK walkthrough. - Provides example commands/snippets for running tests and for a local Headlamp + plugin demo setup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+19
to
+20
| import { createMockTestingModel } from '@headlamp-k8s/ai-common/mock-testing-model/MockTestingModel'; | ||
| const model = createMockTestingModel(); |
Comment on lines
+28
to
+36
| const model = createMockTestingModel({ | ||
| extraFixtures: [ | ||
| { prompt: 'How many replicas does <<name>> have?', | ||
| response: 'The deployment **<<name>>** has 3 replicas.' }, | ||
| ], | ||
| }); | ||
|
|
||
| // Sequence playback — each call returns the next canned response | ||
| const model = createMockTestingModel({ sequenceName: 'cluster-exploration-demo' }); |
| user prompts against fixture files — no API keys, network, or real LLM required. | ||
| Drop-in replacement for any LangChain provider. | ||
|
|
||
| See also: [Mock Testing Model README](../packages/ai-common/src/mock-testing-model/README.md). |
Comment on lines
+65
to
+67
| ```bash | ||
| npx tsx packages/ai-cli/src/cli.ts --config config.json "What is a Pod?" | ||
| ``` |
Comment on lines
+149
to
+150
| Source: `packages/ai-common/src/mcp/test-fixtures/fake-mcp-server.mjs` | ||
|
|
Comment on lines
+210
to
+212
| ### 2. Build and run Headlamp | ||
|
|
||
| ```bash |
Comment on lines
+213
to
+217
| # Build backend | ||
| cd backend && go build -o headlamp-server ./cmd | ||
|
|
||
| # Build frontend | ||
| cd frontend && npm install && npm run build |
Comment on lines
+244
to
+248
| | Screenshot | Description | | ||
| |-----------|-------------| | ||
| |  | KWOK cluster with fake node, pods, and AI panel | | ||
| |  | Chat mode with `testing-model-default` | | ||
| |  | Mock Testing Model configured as default | |
| | Screenshot | Description | | ||
| |-----------|-------------| | ||
| |  | KWOK cluster with fake node, pods, and AI panel | | ||
| |  | Chat mode with `testing-model-default` | |
| The **mock-testing-agent** simulates agent workflows — thinking steps, | ||
| tool calls, and final answers — without a real agent backend or cluster. | ||
|
|
||
| See also: [Mock Testing Agent README](../packages/ai-common/src/mock-testing-agent/README.md). |
a0b4745 to
bfc8b83
Compare
Documents the end-to-end test infrastructure for the AI Assistant: - The `mock-testing-model` is a canned-response `BaseChatModel` that matches prompts against fixture files — no API keys, network, or real LLM required. It is a drop-in replacement for any LangChain provider and is the standard provider used in CI. - The CLI e2e test suite runs via the vitest workspace config and spawns the compiled `headlamp-ai` binary against the mock provider. - Explains how to add new fixture files to extend regression coverage. See `packages/ai-common/src/mock-testing-model/` for the implementation. Signed-off-by: René Dudfield <renedudfield@microsoft.com> Co-authored-by: Ashu Ghildiyal <aghildiyal@microsoft.com> Signed-off-by: Ashu Ghildiyal <aghildiyal@microsoft.com>
bfc8b83 to
9caccab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
docs/e2e-testing.mddocumenting how to run the full end-to-end test suite for the AI assistant, including themock-testing-modelprovider, CLI e2e tests via vitest workspace, and how to add new fixtures.Assisted by Copilot.
Part of the ai-assistant documentation series.