Skip to content

test: add integrations tests#34

Merged
MaximilianAnzinger merged 8 commits into
mainfrom
feature/27-test-create-database-model-integration-tests
Mar 27, 2026
Merged

test: add integrations tests#34
MaximilianAnzinger merged 8 commits into
mainfrom
feature/27-test-create-database-model-integration-tests

Conversation

@vtotalova

Copy link
Copy Markdown
Contributor

Description

Add database integration tests for repository layer using Testcontainers with PostgreSQL 16.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • 📝 Documentation update
  • 🎨 Style/formatting changes (no functional changes)
  • ♻️ Code refactoring (no functional changes)
  • ⚡ Performance improvements
  • 🔧 Configuration changes
  • 🧪 Test additions or modifications
  • 🚀 Deployment/DevOps changes

Related Issues

Changes Made

  • Client: N/A
  • Server:
    • Added Testcontainers dependencies to build.gradle
    • Created AbstractRepositoryTest and AbstractIntegrationTest base classes
    • Added LearningResourceRepositoryTest (14 tests)
    • Added CompetencyRepositoryTest (12 tests)
    • Added UserRepositoryTest (14 tests)
    • Added application-test.yml for test profile
  • Database: N/A
  • Other: N/A

Testing

Test Cases

  • Existing functionality still works
  • New functionality works as expected
  • Edge cases handled appropriately

Manual Testing

  • Tested in development environment
  • Tested with different user roles/permissions (if applicable)

Screenshots/Videos

Before

N/A

After

N/A

@vtotalova vtotalova self-assigned this Feb 9, 2026
Copilot AI review requested due to automatic review settings February 9, 2026 22:32
@vtotalova vtotalova linked an issue Feb 9, 2026 that may be closed by this pull request
@github-actions github-actions Bot added the enhancement New feature or request label Feb 9, 2026
@vtotalova vtotalova added testing 🧪 Test related changes and removed enhancement New feature or request labels Feb 9, 2026
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@vtotalova vtotalova added this to the v0.1.0 milestone Feb 9, 2026
@vtotalova vtotalova changed the title add integrations tests feat: add integrations tests Feb 9, 2026
@github-actions github-actions Bot added enhancement New feature or request and removed testing 🧪 Test related changes labels Feb 9, 2026
@vtotalova vtotalova changed the title feat: add integrations tests test: add integrations tests Feb 9, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the dependencies 📦 Dependency updates label Feb 9, 2026
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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, and Competency repositories, plus a test Spring 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.

Comment thread server/src/test/java/de/tum/cit/memo/repository/CompetencyRepositoryTest.java Outdated
Comment thread server/src/test/resources/application-test.yml Outdated
Comment thread server/src/test/java/de/tum/cit/memo/repository/AbstractRepositoryTest.java Outdated
Comment thread server/src/test/java/de/tum/cit/memo/AbstractIntegrationTest.java Outdated
@github-actions

github-actions Bot commented Feb 9, 2026

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@markstockhausen markstockhausen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR looks good, I believe tests are missing for those two repos:

  • CompetencyRelationshipRepository
  • CompetencyResourceLinkRepository

Once they are done, it can be merged

@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@markstockhausen
markstockhausen self-requested a review March 4, 2026 01:14

@markstockhausen markstockhausen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@github-actions github-actions Bot removed the dependencies 📦 Dependency updates label Mar 23, 2026
@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@github-actions github-actions Bot added configuration ⚙️ Configuration file changes dependencies 📦 Dependency updates labels Mar 23, 2026
@github-actions

Copy link
Copy Markdown

🔍 Code Quality Report

📊 Code Statistics

🚨 Potential Issues

✅ No console statements found
⚠️ Found 'any' or 'unknown' types - consider using more specific types

@MaximilianAnzinger
MaximilianAnzinger merged commit d39b02b into main Mar 27, 2026
8 checks passed
@MaximilianAnzinger
MaximilianAnzinger deleted the feature/27-test-create-database-model-integration-tests branch March 27, 2026 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration ⚙️ Configuration file changes dependencies 📦 Dependency updates enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test: create database model integration tests

4 participants