test: add integration tests for JDBC repositories #15

Merged
skettiks merged 2 commits from test/repository-integration into develop 2026-04-23 19:55:29 +00:00
skettiks commented 2026-04-20 19:51:55 +00:00 (Migrated from github.com)

Добавил интеграционные тесты для User, Film, and FilmLibrary репозиториев
application-test.yaml: настройка тестового окружения

Summary by CodeRabbit

  • Tests
    • Added comprehensive JDBC-backed integration tests for persistence covering users, films, and library entries: CRUD operations, updates, null and edge cases, long-field preservation, find/all behaviors, deletes (including no-op deletes), and cascade delete verification.
  • Chores
    • Added a test runtime configuration standardizing an in-memory database, enabling migrations during tests, and defining test-only service constraints.
Добавил интеграционные тесты для User, Film, and FilmLibrary репозиториев application-test.yaml: настройка тестового окружения <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Tests** * Added comprehensive JDBC-backed integration tests for persistence covering users, films, and library entries: CRUD operations, updates, null and edge cases, long-field preservation, find/all behaviors, deletes (including no-op deletes), and cascade delete verification. * **Chores** * Added a test runtime configuration standardizing an in-memory database, enabling migrations during tests, and defining test-only service constraints. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
coderabbitai[bot] commented 2026-04-20 19:52:02 +00:00 (Migrated from github.com)
ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Free

Run ID: b7805061-32a8-41a9-a09c-e1640a1377ad

📥 Commits

Reviewing files that changed from the base of the PR and between 49f74d1898 and 4f0e8ccbd4.

📒 Files selected for processing (3)
  • src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmLibraryRepositoryIntegrationTest.kt
  • src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmRepositoryIntegrationTest.kt
  • src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/UserRepositoryIntegrationTest.kt

📝 Walkthrough

Walkthrough

Adds three Spring Boot JDBC integration test classes for UserRepository, FilmRepository, and FilmLibraryRepository, plus a test profile config. Tests use an H2 in-memory DB with Flyway, exercise CRUD, edge cases (null/long fields), non-existent deletes, and cascade deletes for FilmLibrary entries.

Changes

Cohort / File(s) Summary
Repository Integration Tests
src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/UserRepositoryIntegrationTest.kt, src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmRepositoryIntegrationTest.kt, src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmLibraryRepositoryIntegrationTest.kt
Added JUnit5 Spring Boot integration tests for JDBC repositories. Tests bootstrap context under test profile, clean DB before/after each test, and verify save/update, findById, findAll, deleteById, non-existent deletions, null handling, long descriptions, and cascade deletes for FilmLibrary when parent User or Film is removed.
Test Configuration
src/test/resources/application-test.yaml
Added test Spring configuration: H2 in-memory datasource in PostgreSQL mode (DB_CLOSE_DELAY=-1), Flyway enabled with migrations at classpath:db/migration, credentials/driver, and test-only service constraints (services.user.blocked-names, services.film.blocked-patterns).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I dug a burrow in test-time soil,
Seeding users, films, and tidy toil.
Migrations hum, the rows align,
Cascade hops when parents resign.
A happy rabbit stamps — "All fine!"


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

<!-- This is an auto-generated comment: summarize by coderabbit.ai --> <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Organization UI **Review profile**: ASSERTIVE **Plan**: Free **Run ID**: `b7805061-32a8-41a9-a09c-e1640a1377ad` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between 49f74d1898b1da8aee3e0deebcdad9b04d2c6628 and 4f0e8ccbd40250d0e5cca4ade8fc2d44c9e7bc03. </details> <details> <summary>📒 Files selected for processing (3)</summary> * `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmLibraryRepositoryIntegrationTest.kt` * `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmRepositoryIntegrationTest.kt` * `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/UserRepositoryIntegrationTest.kt` </details> </details> --- <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough Adds three Spring Boot JDBC integration test classes for UserRepository, FilmRepository, and FilmLibraryRepository, plus a test profile config. Tests use an H2 in-memory DB with Flyway, exercise CRUD, edge cases (null/long fields), non-existent deletes, and cascade deletes for FilmLibrary entries. ## Changes |Cohort / File(s)|Summary| |---|---| |**Repository Integration Tests** <br> `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/UserRepositoryIntegrationTest.kt`, `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmRepositoryIntegrationTest.kt`, `src/test/kotlin/com/project/movienight/adapters/persistence/jdbc/FilmLibraryRepositoryIntegrationTest.kt`|Added JUnit5 Spring Boot integration tests for JDBC repositories. Tests bootstrap context under `test` profile, clean DB before/after each test, and verify save/update, findById, findAll, deleteById, non-existent deletions, null handling, long descriptions, and cascade deletes for FilmLibrary when parent User or Film is removed.| |**Test Configuration** <br> `src/test/resources/application-test.yaml`|Added test Spring configuration: H2 in-memory datasource in PostgreSQL mode (DB_CLOSE_DELAY=-1), Flyway enabled with migrations at `classpath:db/migration`, credentials/driver, and test-only service constraints (`services.user.blocked-names`, `services.film.blocked-patterns`).| ## Estimated code review effort 🎯 3 (Moderate) | ⏱️ ~25 minutes ## Poem > 🐇 I dug a burrow in test-time soil, > Seeding users, films, and tidy toil. > Migrations hum, the rows align, > Cascade hops when parents resign. > A happy rabbit stamps — "All fine!" </details> <!-- walkthrough_end --> <!-- tips_start --> --- > [!NOTE] > <details> > <summary>🎁 Summarized by CodeRabbit Free</summary> > > Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting <https://app.coderabbit.ai/login>. > > </details> <sub>Comment `@coderabbitai help` to get the list of available commands and usage tips.</sub> <!-- tips_end --> <!-- internal state start --> <!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyRUDuki2VmgoBPSACMxTWpTTjx8XADo08SBAB8AKB2gIOxBQYB6GolzGA1vlwAbeBmNNmxgA4V8AKxIMLzfABu8GTwRLAWaLRorjQUiG6UiEg0GAwkxp604iYAYvC2zAAy8OJUogBKJK74SQSiAJIYNERUuPD4GNAk5kqWnFoARENaAMQjkACC9cRksjT0AkKikPgAZoywmKSIOhO0tMhokOR8AFIAIgBCAMJg4mgMlnSQAMruDkSQl/g2KE0kLWo7SwZlwjFsaEQyFW+AokAABnkCsVSsIRJVqrVYSJ4ZBsBgZHDcLASAjQbj3Gt8iQlDASZBQRIfrhkMTSdFXPYGECOowOjQAB64AA0OAIPHgFG6CKRRRKZXRVRqimx8NF8IAqohKBjlXUcerZbqsaI1egCQjTlkGF1mJzqCQzZh6GQYUZpUh8BC2rzJJAZLYSG0MJ8PDxoR5mAjVmgArDFN0zfDVvlmIgnRb4dhtXFceISG72Ra0KtYpASA9YAzuspIPUwdq6IdIKspYgq5qc7jnTLUxTKNXzNx8aK2VgSALKAwkNKpZiVct8K45sDEFx4YhY47uEHsBQMM3l3Fks9EamUQrcRLiZBmNQGAgQy3grYDgBuHdgDdbq+KKuYcsBWSD4EXgWhcWwVwojMBFnDYJpu0zJAADVgh4Oh4Q/ZMHFoS4RHqcCd1wPcDwZel2EUMQeBJLB3G6dhzXoeEMGwWxbCvGj0HEbUmiwlMCQmNjcSlYj90ONj+C3F0mgoYJkFhc1yztXAxHscwsIDIMSDwgjhJIfwAmlAD2GWAAKQzZJTORA0gIIjmwgkdMIkSSJA5jWPYgBKRj/XwaUMF+Ykw0gaiyH9EhA2DT4jgCjAwAnE8mlA8DaXrdBbEQfB0ChSgWTI6hJKCJ8BFcaoKDy9yhNglh4NwRD6CYCgpV8WwxCPJJzGQe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kgshRLIHdWQByFah4DQDEA+ikLQIZGEFIHOktVONJGZNZOxG5MV21HsPKEKFFGqAcErKyl0xoIxOoFgA4CyGVlCHfWegFIL3uG1BlhIDAEHWLLuS4E0WmjrDBE203EJmlC+mTPQnEBekylpzpAwWpHSkyiIVZBrBnIwFalRIoCCAPw53MCoA7NDzUJvPpm6CUE5SUEJnwEeDoDAHxPTD+BXz1QREiA+gwCTA8BsFT0QBEFYUVR1U01fO+KUD7i/I3V/J+SulwFiAPBQ2Av5zSAPFhAwnVCqFYQcFT1cBEBzggsQKuJQPfXQJfR8CUPRk/VwPKnwKlUIIZmIKA0piyk4vmDcF4r5H2n4snU2g2ByVoBvQGyySeLyXyQAA4ptxi5tQdxKZjlt5jFjIBCggZVjNBdBwAoAyB6BP00AecblbipjJEmguBeB+B7jh4pBpiqB5BFAVA1ATK9AoA4JFBVSwJEBVTGlepaBVTWwSASBVTzBhAwQTKtB/LIAAAWAATlWAAHZUraBt0VL0qVLxBt0ogVK0AYrxsSAikZASBsgohaB0rxAilcr8kGAhihjVL1AwBtAUrUrVgikSAVKGAGBxBaBUqil8klNqqBqlNhq0BUrXEVLVgGB8kxrUqGB0qSAsrsgilxsurtBkqzKJEPpcBgqDgwrZjLEoqpRYqLL9rDqIAxR8BVSrofE4qeSaB3qEr7qtAABvAYGg3AQU6y7UWgCYXASoZbOga4GqRQGG/EXAAYDgIpAAX1MseusoIBepBtivis+rus0CAA== --> <!-- internal state end -->
skettiks commented 2026-04-20 19:58:48 +00:00 (Migrated from github.com)

@coderabbitai full review

@coderabbitai full review
coderabbitai[bot] commented 2026-04-20 19:59:06 +00:00 (Migrated from github.com)
Actions performed

Full review triggered.

<!-- This is an auto-generated reply by CodeRabbit --> <details> <summary>✅ Actions performed</summary> Full review triggered. </details>
devitq commented 2026-04-21 18:21:09 +00:00 (Migrated from github.com)

@copilot review

@copilot review
Copilot commented 2026-04-21 18:28:23 +00:00 (Migrated from github.com)

@copilot review

Провел ревью и внес правку по результату: исправил форматирование в интеграционных тестах для прохождения ktlint. Коммит: 4f0e8cc.

> @copilot review Провел ревью и внес правку по результату: исправил форматирование в интеграционных тестах для прохождения ktlint. Коммит: `4f0e8cc`.
devitq commented 2026-04-23 19:44:36 +00:00 (Migrated from github.com)

@coderabbitai review

@coderabbitai review
coderabbitai[bot] commented 2026-04-23 19:44:41 +00:00 (Migrated from github.com)
Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

<!-- This is an auto-generated reply by CodeRabbit --> <details> <summary>✅ Actions performed</summary> Review triggered. > Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused. </details>
devitq (Migrated from github.com) approved these changes 2026-04-23 19:55:20 +00:00
devitq (Migrated from github.com) left a comment

LGTM

LGTM
Sign in to join this conversation.