Skip to content

MCO-2222: /automate-test skill for generating e2e tests from specifications#5864

Merged
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
HarshwardhanPatil07:automate-test-skill
Apr 30, 2026
Merged

MCO-2222: /automate-test skill for generating e2e tests from specifications#5864
openshift-merge-bot[bot] merged 2 commits into
openshift:mainfrom
HarshwardhanPatil07:automate-test-skill

Conversation

@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07 HarshwardhanPatil07 commented Apr 21, 2026

Future integration with Polarion (MCO-2220) and Jira (MCO-2221) planned.

- What I did

New Claude skill that generates MCO e2e test cases in test/extended-priv/ from test specifications provided as a text file. Includes code review learning from past PRs and follows all MCO test framework conventions.
The skill includes:

  • Text file parsing to extract test case ID, steps, expected results, and tags
  • Code review learning from past merged PRs to produce review-ready code
  • Codebase context awareness — reads existing tests and utilities before generating
  • Built-in conventions for the MCO test framework (resource handling, step logging, state recovery, etc.)
  • Build verification via make machine-config-tests-ext

- How to verify it

  1. Run /automate-test ./test-specs.txt "mco security" longduration with a text file containing a test specification
  2. Verify the generated test code follows MCO conventions (correct imports, Describe/It block format, exutil.By steps, defer cleanup)
  3. Verify the test compiles with make machine-config-tests-ext
  4. Verify the test appears in ./_output/linux/amd64/machine-config-tests-ext list

- Description for the changelog
Add /automate-test Claude skill for generating e2e tests from text file specifications.

Summary by CodeRabbit

  • Documentation
    • Added workflow documentation for automated MCO extended-privilege e2e test generation, including code templates and review standards.

New Claude skill that generates MCO e2e test cases in test/extended-priv/
from test specifications provided as a text file. Includes code review
learning from past PRs and follows all MCO test framework conventions.

Future integration with Polarion (MCO-2220) and Jira (MCO-2221) planned.

Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 337bbdac-4e7d-440f-bb85-6b91655631c1

📥 Commits

Reviewing files that changed from the base of the PR and between aac7274 and 053ba38.

📒 Files selected for processing (1)
  • .claude/skills/mco-automate-test-workflow.md
✅ Files skipped from review due to trivial changes (1)
  • .claude/skills/mco-automate-test-workflow.md

Walkthrough

Adds two documentation files describing an AI-assisted workflow and command for generating Machine Config Operator (MCO) extended-privilege e2e tests, including input modes, test-generation conventions, review-pattern extraction, and build/verification steps.

Changes

Cohort / File(s) Summary
AI Workflow Documentation
​.claude/commands/automate-test.md, ​.claude/skills/mco-automate-test-workflow.md
New command definition and workflow docs for automating MCO extended-priv tests: argument/spec-source handling, rules for deriving target test/extended-priv/ Go files, described Go/Ginkgo templates and labeling/skip rules, local and gh api review-pattern aggregation, test-generation guidance, and build/verification steps (make machine-config-tests-ext).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❓ Inconclusive Unable to locate documentation files mentioned in PR summary to verify test naming conventions and static test title requirements. Verify that .claude/commands/automate-test.md and .claude/skills/mco-automate-test-workflow.md files exist and contain guidance for stable, deterministic Ginkgo test names without dynamic values.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'MCO-2222: /automate-test skill for generating e2e tests from specifications' directly and clearly describes the main change: introducing a new Claude-based skill (/automate-test) for generating MCO e2e tests from specifications. It is specific, concise, and accurately summarizes the primary contribution of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Test Structure And Quality ✅ Passed This PR contains only documentation files defining conventions for generating MCO tests, not actual Ginkgo test code subject to quality review.
Microshift Test Compatibility ✅ Passed Documentation files (.md) in .claude/ directory contain only documentation text without Ginkgo test code patterns.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This pull request is a documentation-only addition that does not include any actual Ginkgo e2e test code. The custom check for SNO test compatibility is not applicable because there are no test files to review.
Topology-Aware Scheduling Compatibility ✅ Passed PR adds only documentation files defining Claude AI skill metadata and test generation conventions with no executable code, deployment manifests, or operator/controller implementations.
Ote Binary Stdout Contract ✅ Passed PR contains only markdown documentation files describing Claude skills and workflows for test generation, with no executable Go code that could violate the OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds only markdown documentation files describing MCO e2e test conventions and workflows; no actual Ginkgo test code (Go files with It(), Describe(), Context() blocks) is present.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor Author

HarshwardhanPatil07 commented Apr 21, 2026

/retitle MCO-2222: /automate-test skill for generating e2e tests from specifications

@openshift-ci openshift-ci Bot changed the title Add /automate-test skill for generating e2e tests from specifications MCO-2222: /automate-test skill for generating e2e tests from specifications Apr 21, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 21, 2026

@HarshwardhanPatil07: This pull request references MCO-2222 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Future integration with Polarion (MCO-2220) and Jira (MCO-2221) planned.

- What I did

New Claude skill that generates MCO e2e test cases in test/extended-priv/ from test specifications provided as a text file. Includes code review learning from past PRs and follows all MCO test framework conventions.
The skill includes:

  • Text file parsing to extract test case ID, steps, expected results, and tags
  • Code review learning from past merged PRs to produce review-ready code
  • Codebase context awareness — reads existing tests and utilities before generating
  • Built-in conventions for the MCO test framework (resource handling, step logging, state recovery, etc.)
  • Build verification via make machine-config-tests-ext

- How to verify it

  1. Run /automate-test ./test-specs.txt "mco security" longduration with a text file containing a test specification
  2. Verify the generated test code follows MCO conventions (correct imports, Describe/It block format, exutil.By steps, defer cleanup)
  3. Verify the test compiles with make machine-config-tests-ext
  4. Verify the test appears in ./_output/linux/amd64/machine-config-tests-ext list

- Description for the changelog
Add /automate-test Claude skill for generating e2e tests from text file specifications.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 21, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.claude/skills/mco-automate-test-workflow.md (1)

64-87: Remove unused gomega import from template.

Line 69 imports gomega with alias o, but this alias is never used in the new file structure template (lines 74-86). The template only uses ginkgo (g), exutil, and logger.

♻️ Proposed fix
 import (
 	g "github.com/onsi/ginkgo/v2"
-	o "github.com/onsi/gomega"
 	exutil "github.com/openshift/machine-config-operator/test/extended-priv/util"
 	logger "github.com/openshift/machine-config-operator/test/extended-priv/util/logext"
 )

Note: If gomega assertions are expected in test bodies, add it back with a comment explaining its usage, or add an example assertion in the template.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/skills/mco-automate-test-workflow.md around lines 64 - 87, The
gomega import is unused in the template: remove the alias import o
"github.com/onsi/gomega" from the import block (leaving g, exutil, logger) or
alternatively reintroduce gomega by adding a short example assertion in the test
body (e.g., using o.Expect) with a comment; update the import list accordingly
to eliminate the unused symbol `o`.
.claude/commands/automate-test.md (1)

15-20: Clarify initialization and error handling for the workflow.

The workflow references review_patterns_mco.md (line 17) but doesn't explain how this memory file is created or initialized on first run. Additionally, step 2 mentions fetching patterns from merged PRs via gh api but provides no fallback behavior if GitHub CLI is unavailable or authentication fails. Step 5 also lacks guidance on handling build failures.

📋 Suggested workflow clarifications

Add to step 2:

-2. Learn from previous code reviews — check memory (`review_patterns_mco.md`), fetch new patterns from merged PRs via `gh api` on `openshift/machine-config-operator`.
+2. Learn from previous code reviews — check memory (`review_patterns_mco.md`, create empty if missing), fetch new patterns from merged PRs via `gh api` on `openshift/machine-config-operator`. Fall back to built-in conventions if `gh` is unavailable or fails.

Add to step 5:

-5. Build with `make machine-config-tests-ext` and verify the test appears in listing. Fix any build errors.
+5. Build with `make machine-config-tests-ext` and verify the test appears in listing. If build errors occur, analyze and fix iteratively.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/automate-test.md around lines 15 - 20, Clarify
initialization and error handling in the workflow: document how
review_patterns_mco.md is created/seeded on first run (e.g., generate an empty
file or copy a template if missing) and where that happens in the workflow, add
explicit fallback behavior around the gh api fetch (detect gh presence and auth,
retry/backoff, and fall back to a cached local copy or skip fetch with a clear
warning) and reference the fetch step that calls gh api, and expand step 5 (the
make machine-config-tests-ext build) to include concrete failure handling
instructions (capture build output, retry, run go test or make vet, and provide
guidance on surfacing and fixing compile/test errors) so the workflow is
deterministic and recovers sensibly from missing tools or build failures.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/mco-automate-test-workflow.md:
- Around line 24-34: Add concrete implementation details for the "Code Review
Learning" workflow: define the memory file format and location by specifying
review_patterns_mco.md as a YAML with a "Last Analyzed PR" numeric field and a
"Patterns" list (each entry includes pattern, source PR number, and timestamp);
add initialization logic to create review_patterns_mco.md with Last Analyzed PR:
0 when missing; replace the vague fetch step with explicit gh/GraphQL commands
(use gh api graphql with pullRequests(first:100, after:$cursor, states:MERGED,
orderBy:{field:UPDATED_AT,direction:DESC}) and iterate pagination with the
returned endCursor until null, filtering file paths for test/extended-priv/),
and use REST endpoints gh api /repos/:owner/:repo/pulls/{number}/comments and
/repos/:owner/:repo/pulls/{number}/reviews to fetch inline comments and PR-level
reviews; implement deduplication by normalizing pattern keys (e.g., lowercase
trimmed message + file/path context), grouping identical keys and keeping the
entry with the highest PR number or newest timestamp ("newer wins"), and write
the updated YAML back to review_patterns_mco.md after processing each batch.

---

Nitpick comments:
In @.claude/commands/automate-test.md:
- Around line 15-20: Clarify initialization and error handling in the workflow:
document how review_patterns_mco.md is created/seeded on first run (e.g.,
generate an empty file or copy a template if missing) and where that happens in
the workflow, add explicit fallback behavior around the gh api fetch (detect gh
presence and auth, retry/backoff, and fall back to a cached local copy or skip
fetch with a clear warning) and reference the fetch step that calls gh api, and
expand step 5 (the make machine-config-tests-ext build) to include concrete
failure handling instructions (capture build output, retry, run go test or make
vet, and provide guidance on surfacing and fixing compile/test errors) so the
workflow is deterministic and recovers sensibly from missing tools or build
failures.

In @.claude/skills/mco-automate-test-workflow.md:
- Around line 64-87: The gomega import is unused in the template: remove the
alias import o "github.com/onsi/gomega" from the import block (leaving g,
exutil, logger) or alternatively reintroduce gomega by adding a short example
assertion in the test body (e.g., using o.Expect) with a comment; update the
import list accordingly to eliminate the unused symbol `o`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d8884198-619f-4ce5-820a-01230b058a43

📥 Commits

Reviewing files that changed from the base of the PR and between c3a9db7 and aac7274.

📒 Files selected for processing (2)
  • .claude/commands/automate-test.md
  • .claude/skills/mco-automate-test-workflow.md

Comment thread .claude/skills/mco-automate-test-workflow.md
@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor Author

/hold

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 21, 2026
@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor Author

/unhold

@openshift-ci openshift-ci Bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 29, 2026
@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor Author

/verified by @ptalgulk01 here

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07: This PR has been marked as verified by @ptalgulk01 [here](https://github.com/openshift/machine-config-operator/pull/5881).

Details

In response to this:

/verified by @ptalgulk01 here

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Comment thread .claude/skills/mco-automate-test-workflow.md
@ptalgulk01
Copy link
Copy Markdown
Contributor

Also I think at the end we should try to verify each test step is covered so that we dont miss any step in between.
And if we are trying to add new func(), helpers we have to make sure they are added at end not in between the existing func.

Address reviewer feedback:
- Convention openshift#14: skip tests on SNO/Compact when multiple nodes needed
- Generation rule for IsCompactOrSNOCluster skip at test body start
- Post-generation verification to ensure 1:1 spec step coverage
- Helper functions must be appended at end of file, not inserted between existing ones

Signed-off-by: HarshwardhanPatil07 <harshpat@redhat.com>
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

openshift-ci-robot commented Apr 29, 2026

@HarshwardhanPatil07: This pull request references MCO-2222 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Future integration with Polarion (MCO-2220) and Jira (MCO-2221) planned.

- What I did

New Claude skill that generates MCO e2e test cases in test/extended-priv/ from test specifications provided as a text file. Includes code review learning from past PRs and follows all MCO test framework conventions.
The skill includes:

  • Text file parsing to extract test case ID, steps, expected results, and tags
  • Code review learning from past merged PRs to produce review-ready code
  • Codebase context awareness — reads existing tests and utilities before generating
  • Built-in conventions for the MCO test framework (resource handling, step logging, state recovery, etc.)
  • Build verification via make machine-config-tests-ext

- How to verify it

  1. Run /automate-test ./test-specs.txt "mco security" longduration with a text file containing a test specification
  2. Verify the generated test code follows MCO conventions (correct imports, Describe/It block format, exutil.By steps, defer cleanup)
  3. Verify the test compiles with make machine-config-tests-ext
  4. Verify the test appears in ./_output/linux/amd64/machine-config-tests-ext list

- Description for the changelog
Add /automate-test Claude skill for generating e2e tests from text file specifications.

Summary by CodeRabbit

  • Documentation
  • Added workflow documentation for automated MCO extended-privilege e2e test generation, including code templates and review standards.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

@HarshwardhanPatil07: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@HarshwardhanPatil07
Copy link
Copy Markdown
Contributor Author

/verified by @ptalgulk01 here

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Apr 30, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@HarshwardhanPatil07: This PR has been marked as verified by @ptalgulk01 [here](https://github.com/openshift/machine-config-operator/pull/5881).

Details

In response to this:

/verified by @ptalgulk01 here

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

Copy link
Copy Markdown
Member

@isabella-janssen isabella-janssen left a comment

Choose a reason for hiding this comment

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

/lgtm

Comment thread .claude/commands/automate-test.md
@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Apr 30, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification

No second-stage tests were triggered for this PR.

This can happen when:

  • The changed files don't match any pipeline_run_if_changed patterns
  • All files match pipeline_skip_if_only_changed patterns
  • No pipeline-controlled jobs are defined for the main branch

Use /test ? to see all available tests.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HarshwardhanPatil07, isabella-janssen

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 30, 2026
@openshift-merge-bot openshift-merge-bot Bot merged commit 25df36b into openshift:main Apr 30, 2026
8 checks passed
ptalgulk01 pushed a commit to ptalgulk01/machine-config-operator that referenced this pull request May 15, 2026
…est-skill

MCO-2222: /automate-test skill for generating e2e tests from specifications
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants