Skip to content

Add mock agent and e2e test for operator flow#8

Merged
blublinsky merged 1 commit into
openshift:mainfrom
blublinsky:analysis-flow-test
May 20, 2026
Merged

Add mock agent and e2e test for operator flow#8
blublinsky merged 1 commit into
openshift:mainfrom
blublinsky:analysis-flow-test

Conversation

@blublinsky
Copy link
Copy Markdown
Contributor

@blublinsky blublinsky commented May 14, 2026

address https://redhat.atlassian.net/browse/OLS-3036 and https://redhat.atlassian.net/browse/OLS-3037

Summary

Add an HTTP mock agent (test/agent/) that implements the POST /v1/agent/run contract used by the operator's SandboxAgentCaller, with canned responses per workflow phase (analysis, execution, verification, escalation).

Add a black-box e2e test (test/e2e/) that validates the full analysis flow: Proposal creation → operator reconciliation → sandbox claim → agent HTTP call → AnalysisResult CR → Proposal phase = Proposed → sandbox released on deletion.
Add a kustomize-based SandboxTemplate bundle (test/agent/sandboxtemplate/) with image override support (local tag or Quay).

Add Dockerfile, Makefile, and schemadump CLI helper for building/pushing the mock image and manual curl testing.

What it does NOT change
No operator source code is modified. All changes are under test/, plus docs (README.md, CLAUDE.md) and Makefile targets (test-e2e).

How to run

Terminal 1: apply mock template + start operator

kubectl apply -k test/agent/sandboxtemplate
make run TEMPLATE_NAME=lightspeed-agent-mock

Terminal 2: run e2e tests

make test-e2e
Test plan

go build ./... passes

make test passes (e2e excluded via build tag)

go vet -tags=e2e ./test/e2e/... clean

make test-e2e passes against running operator + mock agent sandbox

Verify on CI (build tag e2e ensures no impact on existing make test)

@blublinsky blublinsky force-pushed the analysis-flow-test branch 5 times, most recently from 1c7a1cb to db819d1 Compare May 15, 2026 13:49
@blublinsky blublinsky changed the title Add mock agent and e2e test for analysis flow Add mock agent and e2e test for operator flow May 15, 2026
@blublinsky blublinsky force-pushed the analysis-flow-test branch 3 times, most recently from 0545ac5 to 10ce0b7 Compare May 18, 2026 15:50
stage.Verification = agenticv1alpha1.VerificationApproval{Agent: proposal.Spec.Verification.Agent}
case agenticv1alpha1.SandboxStepEscalation:
stage.Escalation = agenticv1alpha1.EscalationApproval{}
stage.Escalation = agenticv1alpha1.EscalationApproval{Agent: proposal.Spec.Analysis.Agent}
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.

should Escalation share agent with Analysis stage?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, by design. There's no spec. escalation step on ProposalSpec — escalation reuses the analysis agent. The reconciler's resolve proposal does the same (falls back to the analysis agent for the escalation step). If we add a dedicated escalation step config in the future, this would change.

Comment thread test/agent/main.go Outdated
proposal "github.com/openshift/lightspeed-agentic-operator/controller/proposal"
)

// Per-phase response delays. Set via env vars (e.g. MOCK_DELAY_EXECUTION=60s).
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.

This env var is not implemented in this PR. is it for a follow up?

Copy link
Copy Markdown
Contributor Author

@blublinsky blublinsky May 19, 2026

Choose a reason for hiding this comment

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

stale comment — the env var approach was replaced with hardcoded delays during development. Updated the comment to reflect the actual implementation (60s hardcoded for execution/verification, 0 for analysis/escalation).

@blublinsky blublinsky force-pushed the analysis-flow-test branch from 10ce0b7 to 2bc5556 Compare May 19, 2026 18:07
@raptorsun
Copy link
Copy Markdown
Contributor

/lgtm
I think it is ready for merging :)

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 19, 2026
@blublinsky blublinsky merged commit 8235eff into openshift:main May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants