fix: issue #29 — integration tests flakiness (DB split + SqlTestFixture consolidado) #34
30
database/init/create-test-api-db.sql
Normal file
30
database/init/create-test-api-db.sql
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
-- create-test-api-db.sql
|
||||||
|
-- Creates test databases for integration tests (idempotent).
|
||||||
|
-- Run once per environment on TECNICA3 before executing integration tests.
|
||||||
|
--
|
||||||
|
-- SIGCM2_Test_App -> used by SIGCM2.Application.Tests
|
||||||
|
-- SIGCM2_Test_Api -> used by SIGCM2.Api.Tests
|
||||||
|
-- SIGCM2_Test -> legacy (kept for old branches e.g. pre-merge CAT-001)
|
||||||
|
--
|
||||||
|
-- After creating the DBs, apply V010 to both new DBs:
|
||||||
|
-- See database/README.md > "Test DBs" section for the PowerShell runbook.
|
||||||
|
|
||||||
|
IF DB_ID(N'SIGCM2_Test_App') IS NULL
|
||||||
|
BEGIN
|
||||||
|
CREATE DATABASE [SIGCM2_Test_App]
|
||||||
|
COLLATE Modern_Spanish_CI_AS;
|
||||||
|
PRINT 'Database SIGCM2_Test_App created.';
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
|
PRINT 'Database SIGCM2_Test_App already exists -- skip.';
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF DB_ID(N'SIGCM2_Test_Api') IS NULL
|
||||||
|
BEGIN
|
||||||
|
CREATE DATABASE [SIGCM2_Test_Api]
|
||||||
|
COLLATE Modern_Spanish_CI_AS;
|
||||||
|
PRINT 'Database SIGCM2_Test_Api created.';
|
||||||
|
END
|
||||||
|
ELSE
|
||||||
|
PRINT 'Database SIGCM2_Test_Api already exists -- skip.';
|
||||||
|
GO
|
||||||
20
tests/SIGCM2.TestSupport/TestConnectionStrings.cs
Normal file
20
tests/SIGCM2.TestSupport/TestConnectionStrings.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
[assembly: InternalsVisibleTo("SIGCM2.Api.Tests")]
|
||||||
|
|
||||||
|
namespace SIGCM2.TestSupport;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Centralized connection string constants for integration test databases.
|
||||||
|
/// Single source of truth — change server/credentials here only.
|
||||||
|
/// </summary>
|
||||||
|
public static class TestConnectionStrings
|
||||||
|
{
|
||||||
|
/// <summary>Used by SIGCM2.Application.Tests via SqlTestFixture (parameterless ctor).</summary>
|
||||||
|
public const string AppTestDb =
|
||||||
|
"Server=TECNICA3;Database=SIGCM2_Test_App;User Id=desarrollo;Password=desarrollo2026;TrustServerCertificate=True;";
|
||||||
|
|
||||||
|
/// <summary>Used by SIGCM2.Api.Tests via TestWebAppFactory.</summary>
|
||||||
|
public const string ApiTestDb =
|
||||||
|
"Server=TECNICA3;Database=SIGCM2_Test_Api;User Id=desarrollo;Password=desarrollo2026;TrustServerCertificate=True;";
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user