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

revert : upgrade to spring boot 2.4.0 #888

Merged
merged 2 commits into from
Nov 18, 2024
Merged

revert : upgrade to spring boot 2.4.0 #888

merged 2 commits into from
Nov 18, 2024

Conversation

rajadilipkolli
Copy link
Owner

As kafka-streams are not working

As kafka-streams are not working
Copy link
Contributor

coderabbitai bot commented Nov 18, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • order-service/pom.xml is excluded by !**/*.xml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request introduces several modifications to the order-service module. In the TestOrderServiceApplication class, the method for setting the active Spring profile has been changed to use a system property instead of a method-based approach. The ContainersConfig class has updated the Kafka container's import path and Docker image, while also configuring it to use Kraft mode. Additionally, the OrderRepositoryTest class now explicitly specifies that the existing database configuration should not be replaced during tests.

Changes

File Change Summary
.../TestOrderServiceApplication.java Modified the main method to set the system property for the active Spring profile to AppConstants.PROFILE_LOCAL.
.../common/ContainersConfig.java Changed import for KafkaContainer, updated Docker image to confluentinc/cp-kafka:7.7.1, and added .withKraft().
.../repositories/OrderRepositoryTest.java Updated @AutoConfigureTestDatabase annotation to prevent replacement of existing database configuration.

Possibly related PRs

Suggested labels

component : order-service, type : dependency-upgrade

Poem

🐇 In the service of orders, changes abound,
With profiles now set, the right path is found.
Kafka's new image, a Krafty delight,
Tests run smoother, all systems unite.
Hooray for the tweaks, let’s hop with glee,
For a brighter tomorrow, just wait and see! 🌟


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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

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)
order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java (1)

19-22: Document the reason for using system property

Consider adding a comment explaining why system property is preferred over withAdditionalProfiles() for profile activation. This helps maintain context for the specific approach chosen during the Spring Boot version revert.

+    // Using system property to ensure profile is set before Spring context initialization
+    // This approach was chosen as part of reverting Spring Boot 2.4.0 to maintain compatibility
     System.setProperty("spring.profiles.active", AppConstants.PROFILE_LOCAL);
     SpringApplication.from(OrderServiceApplication::main)
             .with(ContainersConfig.class)
             .run(args);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 623ebd4 and aa74ab1.

⛔ Files ignored due to path filters (1)
  • order-service/pom.xml is excluded by !**/*.xml
📒 Files selected for processing (3)
  • order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java (1 hunks)
  • order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java (2 hunks)
  • order-service/src/test/java/com/example/orderservice/repositories/OrderRepositoryTest.java (1 hunks)
🔇 Additional comments (4)
order-service/src/test/java/com/example/orderservice/TestOrderServiceApplication.java (1)

19-19: Verify profile activation timing with test containers

The change to use system properties for profile activation might affect the initialization order of test containers. Ensure that the profile is set early enough for proper container configuration.

order-service/src/test/java/com/example/orderservice/common/ContainersConfig.java (2)

24-25: ⚠️ Potential issue

Review Kafka configuration changes carefully

The changes to the Kafka container configuration are significant:

  1. Switching to Confluent's Kafka image: While generally more stable, ensure this version (7.7.1) is compatible with your Kafka streams implementation.
  2. Adding Kraft mode: This changes Kafka's consensus mechanism, which could impact stream processing behavior.

Since this PR aims to fix Kafka streams issues, these changes need careful consideration.

Consider the following alternatives:

-        return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.7.1"))
-                .withKraft()
+        return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("6.2.1"))
#!/bin/bash
# Search for Kafka streams usage and version in the codebase
rg "kafka-streams" --type xml --type gradle
rg "KStream|StreamsBuilder" --type java -l

14-14: Verify testcontainers version compatibility

Since this PR is reverting Spring Boot version due to Kafka streams issues, we should ensure the testcontainers import path is compatible with the target version.

✅ Verification successful

The previous results show inconsistent import paths across services. Let's verify the testcontainers version and Spring Boot version to determine the correct import path for the target version we're reverting to.


Import path change is correct and consistent

The import change from org.testcontainers.kafka.KafkaContainer to org.testcontainers.containers.KafkaContainer is correct. The evidence shows:

  • The project is using Spring Boot 3.3.5 and has consistent testcontainers dependencies across services
  • Most services (order-service, inventory-service) are already using the new org.testcontainers.containers.KafkaContainer import path
  • Only catalog-service and payment-service are using the older import path, suggesting they need similar updates
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for testcontainers version in build files
find . -type f -name "pom.xml" -o -name "build.gradle" | xargs grep -l "testcontainers"

# Check the import usage across the codebase
rg "org.testcontainers.(kafka|containers).KafkaContainer" --type java

Length of output: 1169


Script:

#!/bin/bash
# Check testcontainers version in pom.xml files
find . -name "pom.xml" -exec grep -l "testcontainers" {} \; -exec grep -A 5 "testcontainers" {} \;

# Check Spring Boot version in order-service
grep -A 3 "<parent>" order-service/pom.xml

Length of output: 7510

order-service/src/test/java/com/example/orderservice/repositories/OrderRepositoryTest.java (1)

32-32: LGTM! The database configuration change aligns with Spring Boot version revert.

The explicit configuration @AutoConfigureTestDatabase(replace = NONE) is appropriate when reverting from Spring Boot 2.4.0, as it ensures consistent test database behavior with earlier versions, particularly important when using TestContainers.

Let's verify the Spring Boot version in the project:

@rajadilipkolli rajadilipkolli merged commit eac97fe into main Nov 18, 2024
6 of 7 checks passed
@rajadilipkolli rajadilipkolli deleted the revert-order branch November 18, 2024 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant