test(infra): DbDiagnose 用例库不可达自守卫——真探测一次+进程级缓存结论
原守卫 try 挂在 GetYLDbContext() 上永远打不中(EF context 构造不连库, Connect Timeout 发生在首个查询),无库裸跑 14 个用例逐个假红且各耗 15s。 改为 DbDiagnoseGuard.RequireTestDb():CanConnect 真探测一次并缓存, 不可达全批 Inconclusive——裸跑不再有假失败噪音,探测成本 14×15s→1×15s。 连上库的机器行为不变(照常真跑)。
This commit is contained in:
@@ -31,6 +31,7 @@ namespace YLErp.Modules.EodModule
|
||||
[TestCategory("DbDiagnose")]
|
||||
public void Diagnose_FR007_UnderlyingIdMismatch()
|
||||
{
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
@@ -164,6 +165,7 @@ namespace YLErp.Modules.EodModule
|
||||
public void Diagnose_Trade_FR007_ResetDays()
|
||||
{
|
||||
const string TradeNumber = "GLMS-JIATT-20260805-FICC-01-2180120IB";
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
@@ -256,6 +258,7 @@ namespace YLErp.Modules.EodModule
|
||||
public void Diagnose_EOD_vs_Unwind_Compound_DailyCompare()
|
||||
{
|
||||
const string TradeNumber = "GLMS-JIATT-20260805-FICC-01-2180120IB";
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
@@ -367,6 +370,7 @@ namespace YLErp.Modules.EodModule
|
||||
{
|
||||
const string TradeNumber = "GLMS-JIATT-20260805-FICC-01-2180120IB";
|
||||
const long CompoundPositionId = 38122;
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
@@ -431,6 +435,7 @@ namespace YLErp.Modules.EodModule
|
||||
public void Diagnose_Trade_804_ResetDay_FloatRate_Trace()
|
||||
{
|
||||
const string TradeNumber = "GLMS-JIATT-20260805-FICC-01-2180120IB";
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
@@ -528,6 +533,7 @@ namespace YLErp.Modules.EodModule
|
||||
public void Diagnose_Trade_AllLegs_And_EodMapping()
|
||||
{
|
||||
const string TradeNumber = "GLMS-JIATT-20260805-FICC-01-2180120IB";
|
||||
DbDiagnoseGuard.RequireTestDb();
|
||||
YLContext db;
|
||||
try { db = DbContextFactory.GetYLDbContext(); }
|
||||
catch (Exception ex) { Assert.Inconclusive($"无法连接测试库:{ex.Message}"); return; }
|
||||
|
||||
Reference in New Issue
Block a user