@@ -62,11 +62,26 @@ jobs:
6262 --no-build --configuration Release --verbosity normal
6363 --logger "console;verbosity=normal"
6464
65- # ── 3. SQL Server unit tests (no live DB — integration tests filtered out) ────
66- test-sqlserver-unit :
67- name : " Tests — SQL Server (unit only) "
65+ # ── 3. SQL Server tests (full suite against SQL Server 2022 in Docker) ───── ────
66+ test-sqlserver :
67+ name : " Tests — SQL Server"
6868 needs : build
6969 runs-on : ubuntu-latest
70+
71+ services :
72+ sqlserver :
73+ image : mcr.microsoft.com/mssql/server:2022-latest
74+ env :
75+ ACCEPT_EULA : " Y"
76+ MSSQL_SA_PASSWORD : " Pa55w0rd!"
77+ ports :
78+ - 1433:1433
79+ options : >-
80+ --health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P 'Pa55w0rd!' -No -Q 'SELECT 1'"
81+ --health-interval 10s
82+ --health-timeout 5s
83+ --health-retries 10
84+
7085 steps :
7186 - uses : actions/checkout@v4
7287
@@ -81,11 +96,12 @@ jobs:
8196 - name : Build (Release)
8297 run : dotnet build --no-restore --configuration Release
8398
84- - name : " Test: ActiveForge.SqlServer.Tests (unit only)"
99+ - name : " Test: ActiveForge.SqlServer.Tests"
100+ env :
101+ SS_ADMIN_CONNSTR : " Server=localhost,1433;Database=master;User Id=sa;Password=Pa55w0rd!;TrustServerCertificate=True"
85102 run : >
86103 dotnet test tests/ActiveForge.SqlServer.Tests/ActiveForge.SqlServer.Tests.csproj
87104 --no-build --configuration Release --verbosity normal
88- --filter "Category!=Integration"
89105 --logger "console;verbosity=normal"
90106
91107 # ── 4. PostgreSQL integration tests ──────────────────────────────────────────
@@ -132,25 +148,34 @@ jobs:
132148 --logger "console;verbosity=normal"
133149
134150 # ── 5. MongoDB integration tests ─────────────────────────────────────────────
151+ # Transactions require a replica set; service containers can't be started with
152+ # --replSet, so we start MongoDB manually and initialise the replica set.
135153 test-mongodb :
136154 name : " Tests — MongoDB"
137155 needs : build
138156 runs-on : ubuntu-latest
139157
140- services :
141- mongodb :
142- image : mongo:7
143- ports :
144- - 27017:27017
145- options : >-
146- --health-cmd "mongosh --eval 'db.adminCommand(\"ping\")' --quiet"
147- --health-interval 10s
148- --health-timeout 10s
149- --health-retries 5
150-
151158 steps :
152159 - uses : actions/checkout@v4
153160
161+ - name : Start MongoDB replica set
162+ run : |
163+ docker run -d --name mongo \
164+ -p 27017:27017 \
165+ mongo:7 --replSet rs0 --bind_ip_all
166+ # Wait for mongod to accept connections
167+ for i in $(seq 1 30); do
168+ docker exec mongo mongosh --quiet --eval "db.adminCommand('ping')" \
169+ && break || sleep 2
170+ done
171+ # Initialise the single-node replica set
172+ docker exec mongo mongosh --quiet --eval "rs.initiate({_id:'rs0',members:[{_id:0,host:'127.0.0.1:27017'}]})"
173+ # Wait until the node becomes PRIMARY
174+ for i in $(seq 1 20); do
175+ STATUS=$(docker exec mongo mongosh --quiet --eval "rs.status().myState")
176+ [ "$STATUS" = "1" ] && break || sleep 2
177+ done
178+
154179 - name : Setup .NET 8
155180 uses : actions/setup-dotnet@v4
156181 with :
0 commit comments