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

chore: Added capability of running ITs on maven #38354

Merged
merged 1 commit into from
Dec 24, 2024
Merged

Conversation

nidhi-nair
Copy link
Contributor

@nidhi-nair nidhi-nair commented Dec 24, 2024

Description

Enables running UTs and ITs as desired on maven. The skipTests command continues to skip all tests.
To run only UTs, use:
mvn test

To run only ITs, use:
mvn verify -DskipUTs=true

Automation

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

Summary by CodeRabbit

  • New Features

    • Enhanced context management by associating artifactType with the extensionContext.
    • Updated service structure for SSH key pair management, focusing on artifact-level services.
  • Bug Fixes

    • Improved test execution control with new properties for skipping tests in the build process.
  • Documentation

    • Enhanced test configuration and management within the Maven build process.

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12483043596
Commit: 9b65433
Cypress dashboard.
Tags: @tag.Git
Spec:


Tue, 24 Dec 2024 15:24:20 UTC

@nidhi-nair nidhi-nair requested review from sharat87 and a team as code owners December 24, 2024 13:51
Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request introduces modifications to the Appsmith server's Git-related components, focusing on artifact type management and test configuration. The changes involve updating the GitContext and GitServerInitializerExtension classes to better handle artifact types, and enhancing the Maven pom.xml with more flexible test execution controls.

Changes

File Change Summary
app/server/appsmith-server/src/test/it/.../GitContext.java Added artifactType to contextStore in constructor
app/server/appsmith-server/src/test/utils/.../GitServerInitializerExtension.java Replaced ApplicationService with ArtifactService, updated SSH key pair creation method
app/server/pom.xml Added test execution control properties, updated Maven plugins for test source directories

Sequence Diagram

sequenceDiagram
    participant GitContext
    participant GitServerInitializerExtension
    participant ArtifactService
    
    GitContext->>GitContext: Store artifactType in contextStore
    GitServerInitializerExtension->>ArtifactService: createOrUpdateSshKeyPair(artifactType, artifactId, keyType)
Loading

Possibly related PRs

Suggested labels

skip-changelog, Task, Git Product, ok-to-test

Suggested reviewers

  • sondermanish

Poem

🌿 Git's dance of code and context light,
Artifacts bloom with newfound might,
Maven's tests now skip or soar,
Refactoring opens a brand new door!
🚀 Coding magic takes its flight!


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 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 the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 24, 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

🧹 Nitpick comments (1)
app/server/pom.xml (1)

80-103: Adding multiple test sources via build-helper-maven-plugin
Defining src/test/java, src/test/it, and src/test/utils allows a cleaner test organization. This step helps maintain clarity between unit, integration, and utility tests.

Consider adding comments or documentation explaining the semantic purpose of each test directory.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c0d393a and 9b65433.

📒 Files selected for processing (3)
  • app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java (1 hunks)
  • app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java (3 hunks)
  • app/server/pom.xml (3 hunks)
🔇 Additional comments (8)
app/server/appsmith-server/src/test/it/com/appsmith/server/git/templates/contexts/GitContext.java (1)

28-28: Storing artifactType in the context store
This additional context store entry helps streamline the retrieval of artifactType in the extension. The change is minimal and makes sense in ensuring consistent artifact-type handling downstream.

app/server/appsmith-server/src/test/utils/com/appsmith/server/git/GitServerInitializerExtension.java (3)

4-5: Replacing ApplicationService with ArtifactService
Switching to ArtifactService clearly aligns the implementation with artifact-centric operations. This change appears consistent with the new workflow.

Also applies to: 40-40


59-59: ArtifactType usage
Retrieving ArtifactType from the parent context ensures the appropriate artifact type is mapped before creating the SSH key pair. This is a good design approach.


67-67: Creating or updating SSH key pair
The createOrUpdateSshKeyPair call on artifactService is well-structured. Ensure the returned mono (i.e., gitAuthMono) handles errors gracefully in upstream code.

app/server/pom.xml (4)

46-48: Granular test skipping flags
Introducing <skipITs>, <skipTests>, and <skipUTs> provides fine control over test execution. This meets the PR objective of distinguishing UT from IT runs.


114-116: Surefire test configuration
Setting <testSourceDirectory> to src/test/java and using <skipTests>${skipUTs}</skipTests> is a direct and effective way to skip only unit tests when needed.


117-129: JUnit Jupiter engine dependency for unit tests
It’s good to see version consistency across JUnit dependencies. Excluding junit-platform-commons is consistent with your test framework strategy.


130-148: Failsafe integration test configuration
Pointing <testSourceDirectory> to src/test/it and referencing <skipITs> matches the intended separation of UTs and ITs. This streamlines build management.

@nidhi-nair nidhi-nair added the ok-to-test Required label for CI label Dec 24, 2024
@@ -40,7 +37,7 @@
public class GitServerInitializerExtension implements BeforeAllCallback, BeforeEachCallback, AfterEachCallback, AfterAllCallback {

@Autowired
ApplicationService applicationService;
ArtifactService artifactService;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be parameterized?

Copy link
Contributor

Choose a reason for hiding this comment

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

probably not in the scope of this PR, however something to note down

@nidhi-nair nidhi-nair merged commit 2dfa24e into release Dec 24, 2024
51 checks passed
@nidhi-nair nidhi-nair deleted the chore/mvn-its branch December 24, 2024 20:38
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