-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
chore: test cases with real file-system operations #33668
chore: test cases with real file-system operations #33668
Conversation
WalkthroughThe update introduces a new feature flag for enabling Git server auto-commit functionality. It includes enhancements to the Git auto-commit process, schema migrations, and methods for handling repository paths. Significant refactoring was done to improve code maintainability and test coverage, particularly concerning JSON schema migrations and auto-commit logic for client and server-side events. Changes
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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: 31
Outside diff range and nitpick comments (5)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/AutoCommitEventHandlerImpl.java (1)
[!TIP]
Codebase VerificationThe dependencies
CommonGitFileUtils
andGitExecutor
are included in the constructor ofAutoCommitEventHandlerImpl
but are not utilized within the class. This indicates that these dependencies might be unnecessary.
CommonGitFileUtils
andGitExecutor
are only present in the constructor and not used in any methods.Analysis chain
Line range hint
22-31
: Constructor updated to includeCommonGitFileUtils
andGitExecutor
. Ensure that these dependencies are properly integrated and utilized within the class.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the integration of CommonGitFileUtils and GitExecutor in AutoCommitEventHandlerImpl. # Test: Search for the usage of CommonGitFileUtils and GitExecutor in AutoCommitEventHandlerImpl. ast-grep --lang java --pattern $'class AutoCommitEventHandlerImpl { $$$ CommonGitFileUtils($_); GitExecutor($_); $$$ }'Length of output: 128
Script:
#!/bin/bash # Description: Verify the integration of CommonGitFileUtils and GitExecutor in AutoCommitEventHandlerImpl. # Test: Search for the usage of CommonGitFileUtils in AutoCommitEventHandlerImpl. rg 'CommonGitFileUtils' --glob '**/AutoCommitEventHandlerImpl.java' # Test: Search for the usage of GitExecutor in AutoCommitEventHandlerImpl. rg 'GitExecutor' --glob '**/AutoCommitEventHandlerImpl.java'Length of output: 729
Script:
#!/bin/bash # Description: Verify the usage of CommonGitFileUtils and GitExecutor in methods of AutoCommitEventHandlerImpl. # Test: Search for method implementations in AutoCommitEventHandlerImpl. ast-grep --lang java --pattern $'class AutoCommitEventHandlerImpl { $$$ $_($_) { $$$ } $$$ }' --json # Test: Search for the usage of CommonGitFileUtils in methods of AutoCommitEventHandlerImpl. rg 'commonGitFileUtils' --glob '**/AutoCommitEventHandlerImpl.java' # Test: Search for the usage of GitExecutor in methods of AutoCommitEventHandlerImpl. rg 'gitExecutor' --glob '**/AutoCommitEventHandlerImpl.java'Length of output: 810
app/server/appsmith-server/src/main/java/com/appsmith/server/helpers/ce/GitAutoCommitHelperImpl.java (1)
3-3
: Consider organizing imports for better readability.Also applies to: 6-6, 15-15, 27-29
app/server/appsmith-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java (1)
380-567
: Ensure proper resource management in tests.Consider using try-with-resources or ensuring that all resources are closed properly in tests to prevent resource leaks, especially when dealing with file operations or external connections.
app/server/appsmith-server/src/test/java/com/appsmith/server/git/GitServiceCETest.java (1)
300-301
: Refactor to use more descriptive test method names.The test method names like
connectApplicationToGit_WhenUserDoesNotHaveRequiredPermission_OperationFails
are quite descriptive, which is good. However, for consistency and clarity, consider using this descriptive naming convention across all test methods. For example,toggleAutoCommit
could be renamed to something more descriptive based on what specific condition or scenario it is testing.app/server/appsmith-server/src/test/java/com/appsmith/server/imports/internal/ImportServiceTests.java (1)
999-999
: Ensure the comment about backward compatibility is not redundant with previous explanations.
...-server/src/test/java/com/appsmith/server/git/autocommit/AutoCommitEventHandlerImplTest.java
Show resolved
Hide resolved
...psmith-server/src/test/java/com/appsmith/server/testhelpers/git/GitFileSystemTestHelper.java
Outdated
Show resolved
Hide resolved
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class GitFileSystemTestHelper { |
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.
Great job on creating a utility out of this
...-server/src/test/java/com/appsmith/server/services/ApplicationPageServiceAutoCommitTest.java
Outdated
Show resolved
Hide resolved
gitExecutor.createAndCheckoutToBranch(suffix, branchName).block(); | ||
|
||
// save the files from into repo from json | ||
// This would later be replaced by the files in resources |
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.
Let's create a task for this please
3a8854d
into
chore/server-autocommit-refactor
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?