-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
test: CGS connect negative tests #38120
Conversation
WalkthroughThe pull request introduces significant modifications to the Git-related services in the Appsmith application. Key changes include refactoring the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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 (3)
app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (1)
328-337
: Consider adding error type differentiationThe implementation looks good, but for consistency with
fetchRemoteRepository
, consider differentiating between different types of Git errors (e.g., EmptyCommitException is already handled elsewhere in the code).return fsGitHandler .commitArtifact( repoSuffix, commitDTO.getMessage(), commitDTO.getAuthor().getName(), commitDTO.getAuthor().getEmail(), true, commitDTO.getIsAmendCommit()) - .onErrorResume(error -> Mono.error( - new AppsmithException(AppsmithError.GIT_ACTION_FAILED, "commit", error.getMessage()))); + .onErrorResume(error -> { + if (error instanceof EmptyCommitException) { + return Mono.error(new AppsmithException(AppsmithError.GIT_ERROR_EMPTY_COMMIT)); + } + return Mono.error(new AppsmithException(AppsmithError.GIT_ACTION_FAILED, "commit", error.getMessage())); + });app/server/appsmith-server/src/test/java/com/appsmith/server/git/ops/GitConnectTests.java (1)
165-181
: Refactor repeated setup code in testsRepeated code for creating users, workspaces, and applications is present in multiple test methods. Consider extracting this setup code into helper methods or using
@BeforeEach
to improve code maintainability.app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java (1)
Line range hint
425-445
: Fix misaligned braces in error handlingThere is a potential syntax error due to misaligned braces in the error handling block. Ensure that the braces correctly match the control structures.
Apply this diff to correct the issue:
} else if (error instanceof ClassCastException) { // To catch TransportHttp cast error in case HTTP URL is passed // instead of SSH URL if (error.getMessage().contains("TransportHttp")) { appsmithException = new AppsmithException(AppsmithError.INVALID_GIT_SSH_URL); - } - } + } + } else { appsmithException = new AppsmithException( AppsmithError.GIT_GENERIC_ERROR, error.getMessage()); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
app/server/appsmith-server/src/main/java/com/appsmith/server/git/central/CentralGitServiceCEImpl.java
(3 hunks)app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java
(2 hunks)app/server/appsmith-server/src/test/java/com/appsmith/server/git/ops/GitConnectTests.java
(1 hunks)app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java
(0 hunks)
💤 Files with no reviewable changes (1)
- app/server/appsmith-server/src/test/java/com/appsmith/server/services/LayoutServiceTest.java
🔇 Additional comments (2)
app/server/appsmith-server/src/main/java/com/appsmith/server/git/fs/GitFSServiceCEImpl.java (1)
218-219
: LGTM! Improved error handling
The enhanced error message now includes the actual exception message, which will help with debugging and troubleshooting.
app/server/appsmith-server/src/test/java/com/appsmith/server/git/ops/GitConnectTests.java (1)
81-100
: Test method implementation is correct
The test connectArtifactToGit_withEmptyRemoteUrl_throwsInvalidParameterException
correctly verifies that an exception is thrown when the remote URL is empty.
Description
Tip
Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).
Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.
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=""
🔍 Cypress test results
Caution
If you modify the content in this section, you are likely to disrupt the CI result for your PR.
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Chores