Conversation
Test Results988 tests 975 ✅ 2m 26s ⏱️ Results for commit 6966230. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
This PR refactors the integration-test infrastructure and related application bootstrapping so tests can run faster/more reliably (pooled DB managers, deterministic data generation, and test-specific logging/environment handling), while also removing a few redundant Razor view imports.
Changes:
- Centralized integration-test environment/logging detection (new
EnvironmentHelper,LoggerUtils) and updated Web/Tools startup to use it. - Major integration-test harness refactor: pooled
RespawnableContextManager, deterministic GUID/data generation, newCustomApiFactory, and new EF “meta” migration/model checks. - Cleanups: remove redundant Razor
@using Microsoft.AspNetCore.Mvc.TagHelpers, switch test timeouts/constants toTestInfraDefaults, and make full-text SQL creation idempotent.
Reviewed changes
Copilot reviewed 92 out of 92 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| Hikkaba.Web/Views/UserAdmin/Delete.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/UserAdmin/Create.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/Thread/Details.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/Thread/Create.cshtml | Removes unused usings; relies on _ViewImports for tag helpers. |
| Hikkaba.Web/Views/Shared/_LoginPartial.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/Shared/DisplayTemplates/PostDetailsViewModel.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/BanAdmin/_CreateBanForm.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Views/BanAdmin/Create.cshtml | Removes redundant TagHelpers using directive. |
| Hikkaba.Web/Utils/LoggerUtils.cs | Adds helper to detect integration-test logging/configuration. |
| Hikkaba.Web/Startup.cs | Uses AddHikkabaIdentity() and new integration-test environment name constant. |
| Hikkaba.Web/Services/MetaDesignTimeDbContextFactory.cs | Adds design-time DbContext factory for EF CLI/tools + tests. |
| Hikkaba.Web/Program.cs | Avoids overriding/shutting down NLog when integration-test logging is already configured. |
| Hikkaba.Web/Models/Nlog/NlogTargetName.cs | Adds strongly-typed wrapper for NLog target names. |
| Hikkaba.Web/Models/Nlog/NlogRuleName.cs | Adds strongly-typed wrapper for NLog rule names. |
| Hikkaba.Web/Extensions/DependencyInjection.cs | Extracts AddHikkabaIdentity() and standardizes integration-test environment checks. |
| Hikkaba.Tools.Manual.Seed/CustomAppFactory.cs | Switches to new integration-test environment name constant. |
| Hikkaba.Tests.Unit/CustomAppFactory.cs | Switches to new integration-test environment name constant. |
| Hikkaba.Tests.Integration/Utils/TestLogUtils.cs | Refactors/limits test logging output (progress-only, gated). |
| Hikkaba.Tests.Integration/Utils/TestDbUtils.cs | Introduces pooled RespawnableContextManager leasing/returning and uses design-time factory for DbContext creation. |
| Hikkaba.Tests.Integration/Utils/StableDataGen.cs | Adds deterministic GUID/phone generation helpers for stable test data. |
| Hikkaba.Tests.Integration/Utils/GuidGenerator.cs | Removed in favor of StableDataGen. |
| Hikkaba.Tests.Integration/Utils/AssertOrThrow.cs | Adds null-assert helper that also satisfies nullable flow analysis. |
| Hikkaba.Tests.Integration/Usings.cs | Adds global NUnit using via global using. |
| Hikkaba.Tests.Integration/Tests/Repositories/User/SetUserDeletedTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/User/ListUsersTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/User/ListCategoryModeratorsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/User/GetUserTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/User/EditUserTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/User/CreateUserTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Thread/ListThreadPreviewsTests.cs | Adjusts scope type and updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Thread/GetThreadDetailsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Thread/GetCategoryThreadTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Thread/EditThreadTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Thread/CreateThreadTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Role/ListRolesTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Role/EditRoleTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Role/DeleteRoleTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Role/CreateRoleTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/SetPostDeletedTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/SearchPostsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/ListThreadPostsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/ListPostsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/EditPostTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Post/CreatePostTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/SetCategoryModeratorsTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/SetCategoryDeletedTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/ListCategoriesTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/GetCategoryTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/EditCategoryTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Category/CreateCategoryTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/SetBanDeletedTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/ListBansTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/GetPostingRestrictionStatusTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/GetBanTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/FindActiveBanTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/Repositories/Ban/CreateBanTests.cs | Updates timeout constant usage (TestInfraDefaults). |
| Hikkaba.Tests.Integration/Tests/IntegrationTestBase.cs | Switches to pooled DB manager + new CustomApiFactory + new AppScope. |
| Hikkaba.Tests.Integration/Tests/DataModel/EfMetaPendingModelChangesTests.cs | Adds meta-tests ensuring migrations/model are up-to-date. |
| Hikkaba.Tests.Integration/Tests/DataModel/EfMetaMigrationsTests.cs | Adds meta-tests applying/rolling back all migrations. |
| Hikkaba.Tests.Integration/Tests/Data/EfMigrationsTests.cs | Removed legacy migrations test (replaced by meta-tests). |
| Hikkaba.Tests.Integration/Services/RespawnableContextManager.cs | Makes manager public, adds async disposal and safer respawn logic. |
| Hikkaba.Tests.Integration/Services/DbContainerManager.cs | Makes container manager public and adds SQL Server startup tuning script. |
| Hikkaba.Tests.Integration/Services/ContextManagerPooledObjectPolicy.cs | Adds pool policy for context managers. |
| Hikkaba.Tests.Integration/ModuleInitializer.cs | Adds module initializer to set env + configure minimal NLog for tests. |
| Hikkaba.Tests.Integration/Models/IAppScope.cs | Removed old scope interface. |
| Hikkaba.Tests.Integration/Models/IAppFactoryScope.cs | Removed old factory scope interface. |
| Hikkaba.Tests.Integration/Models/Defaultable.cs | Adds Defaultable<T> utility to represent “unset vs explicitly null”. |
| Hikkaba.Tests.Integration/Models/ContainerInfo.cs | Makes ContainerInfo public record. |
| Hikkaba.Tests.Integration/Models/AppScope.cs | Refactors scope to include ApplicationDbContext and use WebApplicationFactory<Program>. |
| Hikkaba.Tests.Integration/Hikkaba.Tests.Integration.csproj | Enables implicit usings and adds packages (InMemory, Nito.AsyncEx). |
| Hikkaba.Tests.Integration/GlobalSetUp.cs | Disposes pools and shuts down NLog after tests. |
| Hikkaba.Tests.Integration/FakeTimeProviderFactory.cs | Removes redundant using. |
| Hikkaba.Tests.Integration/Extensions/RespawnableContextManagerExtensions.cs | Removed old stop/deinit extension (replaced by new disposal/pooling approach). |
| Hikkaba.Tests.Integration/Extensions/HttpClientExtensions.cs | Adds Basic Auth helper for integration HTTP tests. |
| Hikkaba.Tests.Integration/Extensions/DbContainerManagerExtensions.cs | Makes extension public; retains stop helper. |
| Hikkaba.Tests.Integration/Extensions/CollectionOrderedConstraintExtensions.cs | Removes redundant using. |
| Hikkaba.Tests.Integration/Exceptions/IntegrationTestException.cs | Removes redundant using. |
| Hikkaba.Tests.Integration/CustomApiFactory.cs | Replaces/renames CustomAppFactory and adjusts host configuration/cleanup. |
| Hikkaba.Tests.Integration/Constants/TestInfraDefaults.cs | Renames TestDefaults to TestInfraDefaults for infra-specific constants. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.cs | Switches from random GUID generator to deterministic counter-based GUIDs. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Thread.cs | Uses deterministic GUIDs for thread salts/blob IDs. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Role.cs | Uses deterministic GUIDs for concurrency stamps. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Post.cs | Uses deterministic GUIDs; adds Thread alias to avoid type-name conflicts. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Category.cs | Removes redundant using. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Ban.cs | Removes redundant using. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.Attachment.cs | Uses deterministic GUIDs for attachment blob IDs. |
| Hikkaba.Tests.Integration/Builders/TestDataBuilder.ApplicationUser.cs | Uses deterministic GUIDs for identity stamps. |
| Hikkaba.Shared/Utils/EnvironmentHelper.cs | Adds centralized environment name helpers/constants. |
| Hikkaba.Shared/Constants/Defaults.cs | Removes old AspNetEnvIntegrationTesting constant. |
| Hikkaba.Data/Migrations/20251201023840_AddThreadTitleFulltextIndex.Up.sql | Makes full-text index creation idempotent via IF NOT EXISTS. |
| Hikkaba.Data/Migrations/20251201023547_AddPostMessageFulltextIndex.Up.sql | Makes catalog/index creation idempotent via IF NOT EXISTS. |
| Directory.Packages.props | Adds Nito.AsyncEx package version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Details commands for applying database migrations, running the application, and seeding test data. Improves developer onboarding by providing a clear guide for local environment setup.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 97 out of 97 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request introduces several improvements to test data generation and environment handling, as well as enhancements to database migration scripts for full-text indexing. The most impactful changes are the switch to deterministic GUID generation for test entities, the addition of a new environment helper utility, and the migration scripts' increased safety through idempotency checks.
Test Data Generation Improvements:
TestDataBuilderclasses for entity fields likeBlobId,BlobContainerId,ConcurrencyStamp, andSalt, using the newNextGuidmethod and relevant input data to ensure reproducible test data. This affects entities such asPost,Audio,Picture,Notice,Document,Role,Thread, andApplicationUser. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21]Environment Handling Enhancements:
EnvironmentHelperinHikkaba.Shared/Utils/EnvironmentHelper.csto centralize environment name management and detection logic, replacing the previous constant and improving clarity and maintainability. [1] [2]Database Migration Improvements:
AddPostMessageFulltextIndex.Up.sqlandAddThreadTitleFulltextIndex.Up.sql) to be idempotent by checking for the existence of catalogs and indexes before creating them, preventing errors during repeated migrations. [1] [2]Dependency Updates:
Nito.AsyncExpackage toDirectory.Packages.props, potentially for improved asynchronous programming support.Code Cleanup:
usingdirectives from several test builder files to streamline imports and improve readability. [1] [2] [3] [4] [5] [6]