Skip to content

ai-assistant: docs: Add e2e testing guide#879

Open
illume wants to merge 1 commit into
headlamp-k8s:mainfrom
illume:docs/ai-assistant-e2e-testing
Open

ai-assistant: docs: Add e2e testing guide#879
illume wants to merge 1 commit into
headlamp-k8s:mainfrom
illume:docs/ai-assistant-e2e-testing

Conversation

@illume

@illume illume commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Adds docs/e2e-testing.md documenting how to run the full end-to-end test suite for the AI assistant, including the mock-testing-model provider, CLI e2e tests via vitest workspace, and how to add new fixtures.

Assisted by Copilot.

Part of the ai-assistant documentation series.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md covering 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 |
|-----------|-------------|
| ![Cluster Overview](screenshots/12-cluster-overview-kwok.png) | KWOK cluster with fake node, pods, and AI panel |
| ![Mock Model Chat](screenshots/14-mock-model-chat-pods-view.png) | Chat mode with `testing-model-default` |
| ![Provider Config](screenshots/05-mock-model-configured.png) | Mock Testing Model configured as default |
| Screenshot | Description |
|-----------|-------------|
| ![Cluster Overview](screenshots/12-cluster-overview-kwok.png) | KWOK cluster with fake node, pods, and AI panel |
| ![Mock Model Chat](screenshots/14-mock-model-chat-pods-view.png) | 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).
@illume illume force-pushed the docs/ai-assistant-e2e-testing branch 2 times, most recently from a0b4745 to bfc8b83 Compare July 8, 2026 11:52
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>
@illume illume force-pushed the docs/ai-assistant-e2e-testing branch from bfc8b83 to 9caccab Compare July 8, 2026 11:59
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.

2 participants