feat(update): update the backend like nodes via quadlet restart [CI]
This commit is contained in:
1 parent
34190f5a04
commit
68c7113adf
23 files changed
+309
-357
No files matched your search
@@ -21,6 +21,15 @@ internal static class Defaults
|
||||
/// 在真实的 Kestrel 端口上启动整个后端(真实的 SQLite 与段文件,只是用临时目录和较快的轮询),
|
||||
/// 并提供管理员客户端(Bearer 令牌)和假 Agent。
|
||||
/// </summary>
|
||||
public sealed class RecordingBackendRestart : MoShiro.Backend.Application.IBackendRestart
|
||||
{
|
||||
private int _count;
|
||||
|
||||
public int Count => Volatile.Read(ref _count);
|
||||
|
||||
public void Request() => Interlocked.Increment(ref _count);
|
||||
}
|
||||
|
||||
public class BackendFixture : IAsyncLifetime
|
||||
{
|
||||
public const string AdminUser = "admin";
|
||||
@@ -47,6 +56,9 @@ public class BackendFixture : IAsyncLifetime
|
||||
/// <summary>带 admin 作用域的 API 令牌的客户端。</summary>
|
||||
public HttpClient Admin { get; private set; } = null!;
|
||||
|
||||
/// <summary>Backend 更新确认之后「请求退出」的次数(测试里不真的退出)。</summary>
|
||||
public RecordingBackendRestart Restarts { get; } = new();
|
||||
|
||||
public IServiceProvider Services => App.Services;
|
||||
|
||||
/// <summary>夹具创建的默认 Probe:合成块(<see cref="ChunkFactory"/>)和单线路的查询都用它。</summary>
|
||||
@@ -267,7 +279,11 @@ public class BackendFixture : IAsyncLifetime
|
||||
options.NodeImageRegistry = string.Empty; // 同理:后台不去真实的镜像仓库取清单
|
||||
options.PhaseDurationScale = 0.2; // 端到端测试里 connect、hold 这些固定 30 秒的阶段缩成 6 秒
|
||||
},
|
||||
configureServices: services => services.AddSingleton<MoShiro.Backend.Application.IReleaseKey>(TestReleaseKey.Instance)); // 登记清单要验发布签名:测试用自己的密钥签
|
||||
configureServices: services =>
|
||||
{
|
||||
services.AddSingleton<MoShiro.Backend.Application.IReleaseKey>(TestReleaseKey.Instance); // 登记清单要验发布签名:测试用自己的密钥签
|
||||
services.AddSingleton<MoShiro.Backend.Application.IBackendRestart>(Restarts); // 更新确认之后只记一笔,不真的退出
|
||||
});
|
||||
await App.StartAsync();
|
||||
string address = App.Services.GetRequiredService<IServer>().Features.Get<IServerAddressesFeature>()!.Addresses.First();
|
||||
BaseAddress = new Uri(address);
|
||||
|
||||
Reference in new issue
Block a user