Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Checking no_data with contains to avoid error #38592

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

sagar-qa007
Copy link
Contributor

@sagar-qa007 sagar-qa007 commented Jan 13, 2025

Description

Found that existing text file was not reading when no_data passed. Fixed the problem by adding that condition.

Fixes # https://app.zenhub.com/workspaces/qa-63316faf86bb2e170ed2e46b/issues/gh/appsmithorg/appsmith/38591

Automation

/ok-to-test tags="@tag.IDE"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12740786426
Commit: 7c4e548
Cypress dashboard.
Tags: @tag.IDE
Spec:


Mon, 13 Jan 2025 05:09:41 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflow for improved test specification handling
    • Enhanced debug logging and error handling in CI test workflow
    • Refined mechanism for processing test input sources
    • Added more robust file checking and fallback logic

@sagar-qa007 sagar-qa007 requested a review from sharat87 as a code owner January 13, 2025 04:42
@sagar-qa007 sagar-qa007 added the ok-to-test Required label for CI label Jan 13, 2025
Copy link
Contributor

coderabbitai bot commented Jan 13, 2025

Walkthrough

The pull request focuses on enhancing the GitHub Actions workflow file for CI testing, specifically improving the handling of specs_to_run input. The changes introduce more robust input processing, comprehensive debug logging, and a refined fallback mechanism for test specifications. The workflow now performs more thorough checks on input sources, handles potential edge cases, and provides clearer logging to aid in troubleshooting test specification selection.

Changes

File Change Summary
.github/workflows/ci-test-limited-with-count.yml - Enhanced input processing for specs_to_run
- Added comprehensive debug logging
- Improved fallback mechanism for limited-tests.txt
- Added file existence check before reading

Suggested labels

Bug, ok-to-test

Suggested reviewers

  • sharat87
  • yatinappsmith

Possibly related PRs

Poem

🤖 Workflow whispers, tests align
Inputs dance, logs now shine bright
Robust checks, no spec left behind
CI's guardian, code's delight! 🚀


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog CI labels Jan 13, 2025
@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=1 update_snapshot=true specs_to_run=cypress/e2e/Regression/ClientSide/Anvil/Widgets/AnvilButtonWidgetSnapshot_spec.ts

Copy link

Copy link
Contributor

@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: 0

🧹 Nitpick comments (2)
.github/workflows/ci-test-limited-with-count.yml (2)

181-184: Consider adding pattern validation for test specs.

The code skips comments but doesn't validate if the remaining lines match the expected Cypress spec file pattern.

Add pattern validation:

 if [[ $line =~ ^#|^\/\/ || -z $line ]]; then
   echo "[DEBUG] Skipped line: '$line'" # Indicate skipped lines
   continue
+elif [[ ! $line =~ \.cy\.(js|ts|jsx|tsx)$ ]]; then
+  echo "[WARN] Invalid spec file pattern: '$line'"
+  continue
 fi

202-204: Remove trailing whitespace.

There are trailing spaces at the end of line 202.

-echo "[DEBUG] Setting specs_to_run to GitHub environment variable: $specs_to_run"
-echo "specs_to_run=$specs_to_run" >> $GITHUB_ENV
-          
+echo "[DEBUG] Setting specs_to_run to GitHub environment variable: $specs_to_run"
+echo "specs_to_run=$specs_to_run" >> $GITHUB_ENV
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2dadb16 and 7c4e548.

📒 Files selected for processing (1)
  • .github/workflows/ci-test-limited-with-count.yml (2 hunks)
🧰 Additional context used
🪛 yamllint (1.35.1)
.github/workflows/ci-test-limited-with-count.yml

[error] 150-150: trailing spaces

(trailing-spaces)


[error] 177-177: trailing spaces

(trailing-spaces)

🔇 Additional comments (2)
.github/workflows/ci-test-limited-with-count.yml (2)

147-161: Enhanced debug logging and input source determination looks good!

The implementation properly checks both inputs.specs_to_run and github.event.inputs.specs_to_run, providing clear logging for better troubleshooting.

🧰 Tools
🪛 yamllint (1.35.1)

[error] 150-150: trailing spaces

(trailing-spaces)


166-187: Verify the file existence check before processing.

The code attempts to read limited-tests.txt without explicitly checking if the file exists first. While ls and cat commands are used, they don't prevent the subsequent file read operation.

Add an explicit file check before processing:

 limited_tests_file="${{ github.workspace }}/app/client/cypress/limited-tests.txt"
+if [[ ! -f "$limited_tests_file" ]]; then
+  echo "[ERROR] Fallback file $limited_tests_file not found!" >&2
+  exit 1
+fi
 ls -l ${{ github.workspace }}/app/client/cypress/limited-tests.txt

Let's verify the current behavior:

✅ Verification successful

Current implementation is functionally safe

The file exists in the repository and the current implementation includes implicit checks through ls and cat commands. While adding an explicit check would improve error handling, the current code will fail visibly if the file is missing or unreadable.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the limited-tests.txt file exists and is readable
if [[ -f "${{ github.workspace }}/app/client/cypress/limited-tests.txt" ]]; then
  echo "File exists and is readable"
  ls -l "${{ github.workspace }}/app/client/cypress/limited-tests.txt"
else
  echo "File does not exist or is not readable"
fi

Length of output: 149


Script:

#!/bin/bash
# Find the limited-tests.txt file
echo "Searching for limited-tests.txt..."
fd "limited-tests.txt" --type f

# If found, try to read its contents
if fd "limited-tests.txt" --type f -x cat {}; then
  echo "File content shown above"
else
  echo "File not found or not readable"
fi

Length of output: 213

🧰 Tools
🪛 yamllint (1.35.1)

[error] 177-177: trailing spaces

(trailing-spaces)

Copy link
Collaborator

@NandanAnantharamu NandanAnantharamu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12740793582.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 3 Total Passed: 0 Total Failed: 0 Total Skipped: 0 *****************************

@sagar-qa007
Copy link
Contributor Author

/ci-test-limit-count run_count=1 runId=12740793582

Copy link

@sagar-qa007 sagar-qa007 merged commit 8c3bcba into release Jan 13, 2025
47 checks passed
@sagar-qa007 sagar-qa007 deleted the ci/limitedworkflowupdate branch January 13, 2025 05:10
Copy link

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12741028237.
Cypress dashboard: Click here!
The following are new failures, please fix them before merging the PR:
To know the list of identified flaky tests - Refer here

***** Repeat Run Summary ***** Total Tests with repeat: 51 Total Passed: 0 Total Failed: 0 Total Skipped: 0 *****************************

@coderabbitai coderabbitai bot mentioned this pull request Feb 10, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants