test: add integrations tests#34
Conversation
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
There was a problem hiding this comment.
Pull request overview
Adds PostgreSQL-backed integration tests for the repository layer using Testcontainers, supporting Issue #27 by validating JPA mappings and repository queries against a real database schema (Flyway migrations + ddl-auto=validate).
Changes:
- Add Testcontainers (PostgreSQL) test dependencies to the server Gradle build.
- Introduce shared Testcontainers-backed base test classes for repository and full-context integration tests.
- Add repository integration test suites for
User,LearningResource, andCompetencyrepositories, plus atestSpring profile config.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| server/build.gradle | Adds Spring Boot Testcontainers + PostgreSQL Testcontainers dependencies (and Lombok processors for test sources). |
| server/src/test/resources/application-test.yml | Adds a test profile configuration for JPA/Flyway/logging (and security properties). |
| server/src/test/java/de/tum/cit/memo/repository/AbstractRepositoryTest.java | Base @DataJpaTest class that starts a PostgreSQL 16 Testcontainer and wires datasource properties. |
| server/src/test/java/de/tum/cit/memo/AbstractIntegrationTest.java | Base @SpringBootTest class with the same PostgreSQL Testcontainer wiring for future full-stack integration tests. |
| server/src/test/java/de/tum/cit/memo/repository/UserRepositoryTest.java | Repository integration tests for UserRepository CRUD and email-related queries/constraints. |
| server/src/test/java/de/tum/cit/memo/repository/LearningResourceRepositoryTest.java | Repository integration tests for LearningResourceRepository, including the random-selection native query. |
| server/src/test/java/de/tum/cit/memo/repository/CompetencyRepositoryTest.java | Repository integration tests for CompetencyRepository, including the random-selection native query. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
markstockhausen
left a comment
There was a problem hiding this comment.
PR looks good, I believe tests are missing for those two repos:
- CompetencyRelationshipRepository
- CompetencyResourceLinkRepository
Once they are done, it can be merged
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
markstockhausen
left a comment
There was a problem hiding this comment.
CompetencyResourceLink, Competency, LearningResource and User repository tests look good.
CompetencyRelationshipRepositoryTest will not work on main. This branch is missing migrations V5–V7 from the scheduling service PR, which replaced the competency_relationships table:
- V5 drops the old table (relationship_type, user_id)
- V6 recreates it as an aggregated model (vote counters + entropy, no user_id)
- V7 adds degree to competencies
These tests were written against the old V1 schema, so they will fail to compile after rebasing. Please rebase onto main and update CompetencyRelationshipRepositoryTest to match the current schema.
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
🔍 Code Quality Report📊 Code Statistics🚨 Potential Issues✅ No console statements found |
Description
Add database integration tests for repository layer using Testcontainers with PostgreSQL 16.
Type of Change
expected)
Related Issues
Changes Made
build.gradleAbstractRepositoryTestandAbstractIntegrationTestbase classesLearningResourceRepositoryTest(14 tests)CompetencyRepositoryTest(12 tests)UserRepositoryTest(14 tests)application-test.ymlfor test profileTesting
Test Cases
Manual Testing
Screenshots/Videos
Before
N/A
After
N/A