feat: harden control-plane deployment
Build web service image / build (push) Successful in 48s

This commit is contained in:
2026-09-12 11:09:42 +08:00
parent 13c31fc902
commit 0d29b828bb
22 changed files with 1213 additions and 71 deletions
@@ -144,6 +144,52 @@ public sealed class RemoteAgentOptionsTests
Assert.Throws<WxAgentException>(() => options.Validate());
}
[Fact]
public void TokenFileIsAcceptedWithoutPuttingTheTokenInConfiguration()
{
var path = Path.Combine(Path.GetTempPath(), "wxagent-token-" + Guid.NewGuid().ToString("N"));
try
{
File.WriteAllText(path, "file-token\n");
var options = new RemoteAgentOptions
{
AuthAddress = "https://control.example",
TokenFile = path,
NodeId = "node-1"
};
options.Validate();
Assert.Equal("file-token", options.GetToken());
Assert.Null(options.Redacted().Token);
Assert.Equal("file-configured", options.TokenState);
}
finally
{
if (File.Exists(path)) File.Delete(path);
}
}
[Fact]
public void ClientCertificateConfigurationRequiresBothPemFiles()
{
var cert = Path.GetTempFileName();
try
{
var options = new RemoteAgentOptions
{
AuthAddress = "https://control.example",
Token = "node-token",
NodeId = "node-1",
ClientCertificateFile = cert
};
Assert.Throws<WxAgentException>(() => options.Validate());
}
finally
{
File.Delete(cert);
}
}
}
public sealed class RemoteAccountContextTests