Skip to content

feat : use testcontainers in dev mode (#6)#2337

Open
rajadilipkolli wants to merge 2 commits into
hantsy:masterfrom
rajadilipkolli-learning:master
Open

feat : use testcontainers in dev mode (#6)#2337
rajadilipkolli wants to merge 2 commits into
hantsy:masterfrom
rajadilipkolli-learning:master

Conversation

@rajadilipkolli
Copy link
Copy Markdown
Contributor

@rajadilipkolli rajadilipkolli commented May 16, 2026

  • New Features

    • Added HTTP endpoints to update and delete posts (PUT /posts/{id}, DELETE /posts/{id}).
  • Tests

    • Refactored tests to use centralized Testcontainers-based test configurations for consistency.
    • Removed scattered in-test container initializers in favor of shared test bootstrap classes.
  • Chores

    • CI workflows now use setup-java@v5 and the Maven wrapper; legacy Docker Compose database startup steps removed.
    • Test/Testcontainers dependencies updated across modules.

@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request standardizes Testcontainers usage across multiple modules by introducing centralized configuration classes and leveraging @Serviceconnection for simplified property binding. It also implements missing update and delete functionality in the boot-start-routes module and adds database timezone support to the R2DBC configuration. Review feedback identifies the need to use specific version tags for Docker images instead of the latest tag to ensure build reproducibility. Additionally, a concurrency issue was found in the boot-start-routes repository implementation where the update logic is non-atomic and prone to race conditions.

@Bean
@ServiceConnection(name = "redis")
GenericContainer<?> redisContainer() {
return new GenericContainer<>(DockerImageName.parse("redis:latest")).withExposedPorts(6379);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

Using the latest tag for Docker images can lead to non-reproducible builds and unexpected failures when the image is updated. It is recommended to use a specific version tag (e.g., redis:7.2-alpine).

Suggested change
return new GenericContainer<>(DockerImageName.parse("redis:latest")).withExposedPorts(6379);
return new GenericContainer<>(DockerImageName.parse("redis:7.2-alpine")).withExposedPorts(6379);

@Bean
@ServiceConnection(name = "cassandra")
CassandraContainer cassandraContainer() {
return new CassandraContainer("cassandra")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

It is recommended to specify a fixed version for the Cassandra image instead of relying on the default latest tag to ensure build reproducibility and stability across different environments.

Suggested change
return new CassandraContainer("cassandra")
return new CassandraContainer("cassandra:4.1")

Comment on lines +113 to +127
Mono<Post> update(UUID id, Post post) {
return Mono.justOrEmpty(DATA.stream().filter(p -> p.getId().equals(id)).findFirst())
.flatMap(existing -> {
Post updated = Post.builder()
.id(id)
.title(post.getTitle())
.content(post.getContent())
.build();
int index = DATA.indexOf(existing);
if (index >= 0) {
DATA.set(index, updated);
}
return Mono.just(updated);
});
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The update method implementation in PostRepository is not atomic and contains a race condition. Between finding the existing post and calling indexOf/set, the list could have been modified by another thread. Furthermore, since Post uses @Data, indexOf(existing) relies on an equality check of all fields; if another thread updates any field of that post in the meantime, indexOf will return -1, causing the update to fail silently. For a repository implementation, using a ConcurrentMap<UUID, Post> would be more robust and provide atomic update operations.

* Upgrade missing module to Springboot 4.0.6

- removes unnecessary nbactions.xml

* implement code review comment
@rajadilipkolli
Copy link
Copy Markdown
Contributor Author

Hi @hantsy , Can you please check and provide your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant