Skip to content

OU-1472: run only changed tests - #1134

Open
PeterYurkovich wants to merge 3 commits into
move-viewsfrom
run-changes
Open

OU-1472: run only changed tests#1134
PeterYurkovich wants to merge 3 commits into
move-viewsfrom
run-changes

Conversation

@PeterYurkovich

@PeterYurkovich PeterYurkovich commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Stack created with GitHub Stacks CLIGive Feedback 💬

Summary by CodeRabbit

  • New Features

    • Added selective Cypress test execution based on changed files, running only relevant tagged tests when possible.
    • Added fallback coverage for global or unmapped changes and skipped runs when no applicable source files changed.
  • Documentation

    • Updated Cypress testing guidance and quick commands to use the new monitoring test workflow.
    • Added instructions for direct spec execution and updated debugging commands.
  • Bug Fixes

    • Corrected a Cypress support import path.

@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

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 12, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 12, 2026

Copy link
Copy Markdown

@PeterYurkovich: This pull request references OU-1472 which is a valid jira issue.

Details

In response to this:

Stack created with GitHub Stacks CLIGive Feedback 💬

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
openshift-ci Bot requested review from etmurasaki and jgbernalp August 12, 2026 19:40
@openshift-ci

openshift-ci Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: PeterYurkovich

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 Aug 12, 2026
@@ -0,0 +1,62 @@
#!/bin/bash

CHANGED_FILES=$(git diff --name-only origin/main...HEAD)

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.

The target branch might be different we should provide it from env defaulting to main

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.

we should add error handling, in shallow checkouts the main branch might not exist.

Comment thread web/package.json
"test-cypress-perses-dev": "node --max-old-space-size=4096 ./node_modules/.bin/cypress run --browser chrome --headless --env grepTags='@perses-dashboards --@xfail'",
"test-cypress-perses": "node --max-old-space-size=4096 ./node_modules/.bin/cypress run --browser chrome --headless --env grepTags='@perses-dashboards --@smoke --@flaky --@xfail'",
"test-cypress-perses-ivt": "node --max-old-space-size=4096 ./node_modules/.bin/cypress run --browser chrome --headless --env grepTags='@perses-dashboards --@smoke --@flaky --@xfail'",
"test-cypress-monitoring": "../scripts/run-selective-e2e.sh",

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.

Is this script in a different PR or should be ./cypress/run-changed.sh

if [ "$RUN_ALL" = true ]; then
echo "Changes affect global scope or unmapped features. Running ALL monitoring tests..."

DEFAULT_TAGS="@alerting @legacy-dashboards @metrics @targets acm-alerting @cluster-health-analyzer @perses-dashboards --@flaky --@xfail"

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.

Suggested change
DEFAULT_TAGS="@alerting @legacy-dashboards @metrics @targets acm-alerting @cluster-health-analyzer @perses-dashboards --@flaky --@xfail"
DEFAULT_TAGS="@alerting @legacy-dashboards @metrics @targets @acm-alerting @cluster-health-analyzer @perses-dashboards --@flaky --@xfail"

Comment thread web/package.json Outdated
"test": "npm run cypress:run:ci",
"test-cypress-console": "./node_modules/.bin/cypress open --browser chrome",
"test-cypress-console-headless": "node --max-old-space-size=4096 ./node_modules/.bin/cypress run --browser chrome --headless",
"test-cypress-monitoring": "node --max-old-space-size=4096 ./node_modules/.bin/cypress run --browser chrome --headless --env grepTags='@alerting+@legacy-dashboards+@metrics+@targets --@flaky --@xfail'",

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.

Do we need to update the cypress docs with these removals?

CHANGED_FILES=$(git diff --name-only origin/main...HEAD)

RUN_ALL=false
declare -A TAGS_TO_RUN

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.

We might need to change this into something POSIX compatible, I got the following issue while trying to run on mac:

./cypress/run-changed.sh: line 6: declare: -A: invalid option
declare: usage: declare [-afFirtx] [-p] [name[=value] ...]

done

if [ "$RUN_ALL" = true ]; then
echo "Changes affect global scope or unmapped features. Running ALL monitoring tests..."

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.

unmapped features already exits

Suggested change
echo "Changes affect global scope or unmapped features. Running ALL monitoring tests..."
echo "Changes affect global scope. Running ALL monitoring tests..."

FEATURE_MAP["perses-dashboards"]="@perses-dashboards"
FEATURE_MAP["targets"]="@targets"

for FILE in $CHANGED_FILES; do

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.

not sure if we have file paths with white spaces, but this will split on white space

@PeterYurkovich
PeterYurkovich force-pushed the run-changes branch 2 times, most recently from 2c3cc81 to 88ad602 Compare August 17, 2026 13:35
@PeterYurkovich
PeterYurkovich force-pushed the run-changes branch 3 times, most recently from 489aca6 to 3ce7387 Compare August 19, 2026 21:21
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 696cf3a1-d04a-45fd-9948-a8dd27d2f07c

📥 Commits

Reviewing files that changed from the base of the PR and between 7d83ffb and ceff405.

📒 Files selected for processing (5)
  • AGENTS.md
  • web/cypress/CYPRESS_TESTING_GUIDE.md
  • web/cypress/run-changed.sh
  • web/cypress/support/alerts/alerts_regressions.cy.ts
  • web/package.json

Included review availability: Your plan provides up to 12 included reviews per hour; 8 remain after this review.


Walkthrough

The pull request adds changed-file-based Cypress monitoring selection, preserves the base Cypress command, updates command documentation, replaces obsolete quick commands, and fixes one Cypress support import path.

Changes

Cypress monitoring execution

Layer / File(s) Summary
Selective monitoring runner
web/cypress/run-changed.sh, web/package.json
The monitoring command maps changed feature directories to Cypress tags and runs the selected tests through a preserved base command.
Command guidance and Cypress compatibility
AGENTS.md, web/cypress/CYPRESS_TESTING_GUIDE.md, web/cypress/support/alerts/alerts_regressions.cy.ts
Quick commands and debugging instructions use the web-rooted monitoring command. COO execution uses tagged Cypress commands. The alert regression imports listPage through a relative path.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 56384

This change introduces selective Cypress monitoring execution while retaining the base test command. No current merge-blocking risk is identified.

Suggested reviewers: jgbernalp

Sequence Diagram(s)

sequenceDiagram
  participant Git
  participant run-changed.sh
  participant npm
  participant Cypress
  Git->>run-changed.sh: Detect changed files
  run-changed.sh->>run-changed.sh: Map changes to Cypress tags
  run-changed.sh->>npm: Invoke monitoring test command
  npm->>Cypress: Run selected tagged tests
Loading
🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (3 skipped: 3 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
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.
Stable And Deterministic Test Names ✅ Passed PASS: The pull request does not add or modify Ginkgo tests. The verified diff changes only Cypress documentation, shell/package scripts, and a Cypress import. Repository searches found no Ginkgo decla…
Test Structure And Quality ✅ Passed PASS: The custom check applies to Ginkgo test code, but this PR changes no Go or Ginkgo files. The five changed paths are documentation, shell/package configuration, and one Cypress import-only change…
Microshift Test Compatibility ✅ Passed The MicroShift compatibility check is not applicable. The pull request changes only Cypress scripts, Cypress TypeScript support code, package metadata, and documentation. The verified pull-request dif…
Single Node Openshift (Sno) Test Compatibility ✅ Passed The check is not applicable. The PR diff from origin/main contains no Go files and no new Ginkgo e2e tests. The changed test files are Cypress TypeScript files (*.cy.ts), plus scripts, documentati…
Topology-Aware Scheduling Compatibility ✅ Passed PASS: The PR changes only Cypress scripts, Cypress test import code, documentation, and web/package.json. The verified PR diff contains no deployment manifests, operator code, controllers, workload …
Ote Binary Stdout Contract ✅ Passed PASS: The pull request changes only Cypress documentation, a shell test-selection script, package metadata, and a TypeScript import. The diff contains no Go or OTE binary code and no main/init/TestMai…
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PASS: The pull request adds or changes Cypress scripts, documentation, package scripts, and one Cypress import. The commit range contains no added Go files or Ginkgo declarations such as It(), `Desc…
No-Weak-Crypto ✅ Passed PASS. The PR changes only Cypress selection scripts, package commands, documentation, and an import path. The focused diff (c54fb25^..HEAD) adds no MD5, SHA1, DES, 3DES, RC4, Blowfish, or ECB usage. A…
Container-Privileges ✅ Passed No custom-check failure was introduced. The PR diff adds Cypress scripts, documentation, test code, and fixture moves, but no added privileged: true, hostPID, hostNetwork, hostIPC, SYS_ADMIN
No-Sensitive-Data-In-Logs ✅ Passed No sensitive-data logging was introduced. The added shell script logs only changed repository paths, feature-directory errors, fixed status text, and Cypress tag names. The other code change only upda…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: running only tests affected by changed files.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch run-changes

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

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants