Skip to content

Commit 5ccf50c

Browse files
committed
test(ef): isolate DB to /ef-tests
1 parent 351293a commit 5ccf50c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/EFCore.Ydb/test/EntityFrameworkCore.Ydb.FunctionalTests/Query/DecimalParameterQueryYdbFixture.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using EntityFrameworkCore.Ydb.FunctionalTests.TestUtilities;
2+
using EntityFrameworkCore.Ydb.Extensions;
23
using Microsoft.EntityFrameworkCore;
34
using Microsoft.EntityFrameworkCore.Diagnostics;
45
using Microsoft.EntityFrameworkCore.TestUtilities;
@@ -16,6 +17,7 @@ public class DecimalParameterQueryYdbFixture
1617
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder)
1718
{
1819
var b = base.AddOptions(builder);
20+
b.UseYdb(GetConnString());
1921
if (CurrentInterceptor is not null)
2022
b.AddInterceptors(CurrentInterceptor);
2123
return b;
@@ -32,6 +34,16 @@ protected override void OnModelCreating(ModelBuilder b, DbContext ctx)
3234
});
3335
}
3436

37+
private static string GetConnString()
38+
{
39+
var cs = Environment.GetEnvironmentVariable("YDB_EF_CONN");
40+
if (!string.IsNullOrWhiteSpace(cs)) return cs;
41+
42+
var endpoint = Environment.GetEnvironmentVariable("YDB_ENDPOINT") ?? "grpc://localhost:2136";
43+
var database = Environment.GetEnvironmentVariable("YDB_DATABASE") ?? "/ef-tests";
44+
return $"{endpoint};database={database}";
45+
}
46+
3547
public class DecimalContext(DbContextOptions options) : DbContext(options);
3648
}
3749

0 commit comments

Comments
 (0)