Add mock agent and e2e test for operator flow#8
Conversation
1c7a1cb to
db819d1
Compare
0545ac5 to
10ce0b7
Compare
| 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} |
There was a problem hiding this comment.
should Escalation share agent with Analysis stage?
There was a problem hiding this comment.
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.
| proposal "github.com/openshift/lightspeed-agentic-operator/controller/proposal" | ||
| ) | ||
|
|
||
| // Per-phase response delays. Set via env vars (e.g. MOCK_DELAY_EXECUTION=60s). |
There was a problem hiding this comment.
This env var is not implemented in this PR. is it for a follow up?
There was a problem hiding this comment.
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).
10ce0b7 to
2bc5556
Compare
|
/lgtm |
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)