Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This project provides AI-driven tools for end-to-end feature development in Open
| `/oape:api-generate <EP-URL>` | Generate Go API types from Enhancement Proposal |
| `/oape:api-generate-tests <path>` | Generate integration test suites for API types |
| `/oape:api-implement <EP-URL>` | Generate controller code from Enhancement Proposal + API types |
| `/oape:e2e-generate <base-branch>` | Generate e2e test artifacts from git diff against base branch |
| `/oape:review <ticket_id> [base_ref]` | Production-grade code review against Jira requirements |
| `/oape:implement-review-fixes <report>` | Automatically apply fixes from a review report |

Expand All @@ -36,6 +37,9 @@ cd /path/to/operator-repo

# 5. Build and verify
make generate && make manifests && make build && make test

# 6. Generate e2e tests for your changes
/oape:e2e-generate main
```

---
Expand Down Expand Up @@ -65,6 +69,7 @@ These repositories can be used to test the OAPE commands. Clone any of them and
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------- | ------------------ |
| [openshift/cluster-ingress-operator](https://github.com/openshift/cluster-ingress-operator) | Good example of controller-runtime patterns | controller-runtime |
| [openshift/cluster-authentication-operator](https://github.com/openshift/cluster-authentication-operator) | Good example of library-go patterns | library-go |
| [openshift/secrets-store-csi-driver-operator](https://github.com/openshift/secrets-store-csi-driver-operator) | CSI driver operator with bash e2e | library-go |

---

Expand Down
38 changes: 28 additions & 10 deletions plugins/oape/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,26 +89,44 @@ Performs a "Principal Engineer" level code review that verifies code changes aga

---

### ZTWIM Test Generator (ZTWIM operator PRs only)
### `/oape:e2e-generate`

Generates test scenarios, execution steps with `oc` commands, and e2e Go code for [openshift/zero-trust-workload-identity-manager](https://github.com/openshift/zero-trust-workload-identity-manager) PRs. Fixtures and docs live under `ztwim-test-generator/`; commands are exposed as `/oape:ztwim-*`.
Generates e2e test artifacts for any OpenShift operator repository by discovering the repo structure and analyzing the git diff from a base branch.

| Command | Description |
|---------|-------------|
| **`/oape:ztwim-generate-all <pr-url>`** | Generate all artifacts in one run: `test-cases.md`, `execution-steps.md`, `<prno>_test_e2e.go`, `e2e-suggestions.md` in `output/ztwim_pr_<number>/`. |
| `/oape:ztwim-generate-from-pr <pr-url>` | Generate only test scenarios (`test-cases.md`). |
| `/oape:ztwim-generate-execution-steps <pr-url>` | Generate only execution steps (`execution-steps.md`). |
| `/oape:ztwim-generate-e2e-from-pr <pr-url>` | Generate only e2e Go code and suggestions. |
**Usage:**
```shell
# Generate e2e tests for changes since main
/oape:e2e-generate main

See [ztwim-test-generator/README.md](ztwim-test-generator/README.md) for fixtures and usage.
# Use a specific base branch and custom output directory
/oape:e2e-generate origin/release-4.18 --output .work
```

**What it does:**
1. **Prechecks** -- Validates the base branch argument, required tools (`git`, `go`), repository type (must be an OpenShift operator repo with controller-runtime or library-go), and verifies a non-empty git diff.
2. **Discovery** -- Detects framework (controller-runtime vs library-go), API types, CRDs, existing e2e test patterns, install mechanism (OLM or manual), operator namespace, and sample CRs.
3. **Diff Analysis** -- Categorizes changed files (API types, controllers, CRDs, RBAC, samples) and reads diff hunks to understand specific changes.
4. **Generation** -- Produces four files in `output/e2e_<repo-name>/`:
- `test-cases.md` -- Test scenarios with context, prerequisites, install, CR deployment, diff-specific tests, verification, cleanup
- `execution-steps.md` -- Step-by-step `oc` commands
- `e2e_test.go` or `e2e_test.sh` -- Go (Ginkgo) or bash test code matching the repo's existing e2e pattern
- `e2e-suggestions.md` -- Coverage recommendations

**Supports:**
- controller-runtime operators (Ginkgo e2e) -- e.g., cert-manager-operator, external-secrets-operator
- library-go operators (bash e2e) -- e.g., secrets-store-csi-driver-operator
- Operators with in-repo API types or external types from openshift/api

See [e2e-test-generator/](e2e-test-generator/) for fixture templates and pattern documentation.

## Prerequisites

- **gh** (GitHub CLI) -- installed and authenticated
- **go** -- Go toolchain
- **git** -- Git
- **gh** (GitHub CLI) -- installed and authenticated (for api-generate, api-implement, review)
- **make** -- Make (for api-implement)
- **curl** -- For fetching Jira issues (for review)
- **oc** -- OpenShift CLI (recommended, for running generated execution steps)
- Must be run from within an OpenShift operator repository

## Conventions Enforced
Expand Down
Loading