Skip to content

Merge pull request #11 from The-Dave-Stack/feature/task-14-e2e-tests-with-testcontainers#12

Merged
telco2011 merged 62 commits into
mainfrom
develop
Aug 4, 2025
Merged

Merge pull request #11 from The-Dave-Stack/feature/task-14-e2e-tests-with-testcontainers#12
telco2011 merged 62 commits into
mainfrom
develop

Conversation

@telco2011

Copy link
Copy Markdown
Collaborator

No description provided.

telco2011 added 30 commits July 29, 2025 16:23
Updates the tech context document to include project paths.
Marks the "Initialize Git Repository and Branches" task as done
and adds completion notes to the task.
Updates the memory bank to reflect the creation of the remote GitHub repository and the pushing of all branches. This completes task-4.
Updates the acceptance criteria in the task-4 file to mark them as complete.
Adds a comprehensive log of all steps taken to complete the task, including troubleshooting steps and timestamps.
feat(project): create remote github repository
- Creates a docker-compose.yml file to define a PostgreSQL service.
- This allows for a reproducible database environment for local development and testing.
- The application is confirmed to connect to this database successfully.
Updates task statuses and reorders next steps based on
completed database setup. Removes outdated known issues.
Updates the task-5 documentation to include the pull
request link and timestamps for task completion.
…cker

feat(db): set up postgresql with docker-compose
Completed task-2: Verified the initial Spring Boot project setup.
- Confirmed pom.xml dependencies.
- Confirmed application.properties configuration.
- Successfully ran `mvn clean package`.
Marks the initial Spring Boot project setup task as complete.

Verifies project generation, dependencies, configuration, and
successful build using the mcp tool.
…oject

feat(project): Verify initial Spring Boot project setup
Moves the completed API design document task from the
'tasks' backlog to the 'completed' backlog, and removes
unnecessary .gitkeep files.
- Create the 'Product' entity class with all the fields and annotations.
- Add Testcontainers dependency to pom.xml.
- Configure application.properties for tests to use Testcontainers.
…ct-entity

feat(db): define Product JPA entity
- Adds the first Flyway migration script to create the 'products' table.
- The schema includes columns for id, sku, name, description, price, category, created_at, and updated_at.
- This commit fulfills the requirements of task-7.
…al-db-schema

feat(db): create initial products table schema
- Creates the `ProductRepository` interface extending `JpaRepository`.
- Adds `findBySku` and `existsBySku` methods.
- Implements a `DataJpaTest` using Testcontainers to validate the repository methods against a real PostgreSQL database.
…ct-repository-interface

feat(repository): create product repository and tests
Adds the ProductRepository interface to enable data access and integration tests.
Updates project memory bank and tasks.
telco2011 added 29 commits July 31, 2025 17:53
- Create ProductController with POST and GET endpoints.
- Add CreateProductRequest and ProductResponse DTOs.
- Implement ProductMapper for entity-DTO conversion.
- Add GlobalExceptionHandler for ProductNotFoundException.
- Write unit and integration tests for the controller.
- Removes duplicate imports in ProductController.
- Adjusts formatting and improves readability across files.
Finishes the implementation of the product controller,
including DTOs, exception handling, and validation.
Add the required file headers to all the new files created in the previous commit.
feat(api): implement REST endpoints for products
Centralizes PostgreSQL Testcontainer management using a
singleton pattern and a base integration test class.

This streamlines test setup, avoids redundant container
initialization, and improves test suite performance by
reusing a single container instance across multiple tests.

Removes the need for `@Testcontainers` and
`@DynamicPropertySource` annotations in individual test
classes, simplifying their configuration.
Updates the test implementation plan in the markdown file.
It clarifies that the existing Unit and Repository tests
should be checked and updated if needed, instead of
creating them from scratch.
…ntroller

- Added a unit test for the ProductService to handle empty lists in createMultipleProducts.
- Added integration tests for the ProductController's GET /api/v1/products/{id} endpoint, covering both success and not-found scenarios.
- Verified that all tests pass and the project builds successfully.
- Updated activeContext.md to reflect the new work focus and next steps.
- Updated progress.md to include the completion of the comprehensive test suite.
feat(test): Add unit and integration tests for product service and controller
Binds the checkstyle plugin's check goal to the verify phase.
This ensures checkstyle runs during the Maven verify lifecycle,
enforcing code style compliance.
Adds unit, repository, and integration tests to cover
ProductService, ProductRepository, and ProductController.

- Includes a new unit test for ProductService to handle
  empty product lists.
- Integrates Testcontainers for ProductController
  integration tests, covering success and failure scenarios.
- Create a multi-stage Dockerfile to build and run the application in a container.
- Use bellsoft/liberica-openjre-debian:21 as the base image.
- Add a HEALTHCHECK instruction to verify the application's health.
- Expose the health endpoint in application.properties.
- Update activeContext.md and progress.md to reflect the completion of task-12.
- Update the task file with implementation notes and mark acceptance criteria as complete.
Updates task-12 acceptance criteria to reflect completion of the verification process for the Dockerfile.
…-verify-dockerfile

feat(deployment): add multi-stage Dockerfile with healthcheck
This commit introduces a new Maven module 'e2e-tests' for end-to-end testing of the Product Catalog API.

- Created 'e2e-tests' directory and its pom.xml with Testcontainers, RestAssured, and JUnit 5 dependencies.
- Converted the main 'product-catalog-spring' project to a multi-module project by setting its packaging to 'pom' and adding 'e2e-tests' as a module. (Reverted this change later to make e2e-tests standalone due to Maven build issues).
- Created BaseE2ETest.java to manage Docker Compose container lifecycle for tests.
- Created ProductE2ETest.java with basic CRUD E2E tests.
- Addressed initial 'Non-resolvable parent POM' and 'FileNotFoundException' by adjusting pom.xml and BaseE2ETest.java paths.
- Tests are currently failing due to Testcontainers container startup issues.

Resolves: #14
This commit updates the status of task-14 to 'Blocked' in the backlog and adds a detailed summary of the completion attempt to its notes.

The E2E test module and initial tests have been implemented, but the tests are currently failing due to Testcontainers container startup issues. This issue requires further investigation.

Resolves: #14
- Create standalone e2e-tests Maven module with Testcontainers
- Add BaseE2ETest with Docker Compose integration
- Implement ProductE2ETest with comprehensive API testing
- Configure Testcontainers to use docker-compose.yml
- Add REST Assured for HTTP testing
- Tests successfully start containers and run against real application

Note: Some test failures remain due to business logic gaps:
- SKU generation uses UUIDs instead of expected format
- Duplicate SKU prevention not implemented
- Input validation needs refinement
- Error message format requires adjustment

Resolves: task-14 (infrastructure complete, business logic fixes needed)
- Remove separate e2e-tests module
- Add E2E tests directly to src/test with Testcontainers PostgreSQL
- Add RestAssured dependency for API testing
- Create BaseE2ETest with PostgreSQL container setup
- Implement ProductControllerE2ETest with comprehensive API tests
- Add debug logging configuration for E2E tests
- Add application-test-e2e.properties for E2E test configuration

The E2E tests now run against the actual Spring Boot application
with a Testcontainers-managed PostgreSQL database, providing
true end-to-end testing without external dependencies.
Moved GitHub Actions workflows from spring/.github/ to repository root .github/
to support multi-framework repository structure with both Spring and Helidon implementations.

- Updated workflow paths to use working-directory for Spring project
- Added placeholder for Helidon validation in PR workflow
- Configured Docker image names with framework suffix (-spring)
- Added release-drafter configuration for automated releases

Resolves: Proper CI/CD setup for multi-framework repository
Adds GitHub Actions workflows for CI/CD of Spring Boot and
Helidon applications, including PR validation, develop/main
branch deployments, versioning, Docker image building/pushing,
and release management.

- Sets up separate workflows for develop and main branches for
  each framework.
- Implements versioning using semantic-version for main branch
  and RC versions for develop.
- Configures Docker image building and pushing to ghcr.io.
- Includes tests, code formatting checks, and artifact uploading.
- Adds release drafting and changelog generation.
- Skips deployment if the respective implementation isn't yet available.
Removes trailing whitespace in ProductNotFoundException.java

This cleans up the code and adheres to general code style conventions.
…with-testcontainers

feat(e2e): integrate E2E tests into main Spring Boot project
@telco2011 telco2011 merged commit 109c6f6 into main Aug 4, 2025
5 of 8 checks passed
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