test: share one operator and trust root across the trust tests; make the setup test cleanup best-effort [CI SKIP]
This commit is contained in:
1 parent
f22fdf8b68
commit
4a1e48db20
4 files changed
+91
-87
No files matched your search
@@ -44,7 +44,20 @@ public sealed class SetupTests : IAsyncLifetime
|
||||
await _app.StopAsync();
|
||||
await _app.DisposeAsync();
|
||||
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools(); // 连接池还拿着数据库文件
|
||||
Directory.Delete(_directory, recursive: true);
|
||||
TryDelete(_directory);
|
||||
}
|
||||
|
||||
/// <summary>临时目录:尽力删除。SQLite 的 WAL 临时文件可能还没释放,留下一个临时目录比让测试失败好。</summary>
|
||||
private static void TryDelete(string directory)
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(directory, recursive: true);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// 系统临时目录里的残留,会被清理
|
||||
}
|
||||
}
|
||||
|
||||
private Task<HttpResponseMessage> SetupAsync(string? code, string username, string password, bool returnSession = false) =>
|
||||
@@ -143,7 +156,7 @@ public sealed class SetupTests : IAsyncLifetime
|
||||
await generated.StopAsync();
|
||||
await generated.DisposeAsync();
|
||||
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
|
||||
Directory.Delete(directory, recursive: true);
|
||||
TryDelete(directory);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user