Master-URL: ongeldige of placeholder-waarde wordt nooit opgeslagen of verstuurd (master slaat achtergrondchecks over, slave weigert met 400, poller meldt invalid_master_url); veilige diagnostiek bij een mislukte poll; releasenote Master__MasterUrl

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 21:08:47 +01:00
co-authored by Claude Sonnet 5.5
parent 64a467b41b
commit 195443d9a9
11 changed files with 230 additions and 4 deletions
@@ -252,6 +252,40 @@ public class CmsInstanceServiceTests
await _repo.DidNotReceive().GetActiveAsync();
}
[Theory]
[InlineData("<public-url-of-this-master-instance>")]
[InlineData("")]
[InlineData("master.example.com")]
public async Task VerifyIntegrityAsync_NeverReregistersASlave_WithAnUnusableConfiguredMasterUrl(string configured)
{
// The shipped appsettings hold a placeholder: it used to overwrite the slave's good master address.
_httpContextAccessor.HttpContext.Returns((HttpContext?)null);
var sut = new CmsInstanceService(new MasterServiceDependencies(
_repo, _slaveClient, _protector, Options.Create(new MasterModuleOptions { MasterUrl = configured }),
_httpContextAccessor, _logger));
await sut.VerifyIntegrityAsync();
await _repo.DidNotReceive().GetActiveAsync();
await _slaveClient.DidNotReceive().RegisterMasterAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>());
}
[Fact]
public async Task VerifyIntegrityAsync_RepairsAPlaceholderInTheSlave_AsSoonAsTheConfiguredUrlIsValid()
{
var instance = ActiveInstance();
_repo.GetActiveAsync().Returns([instance]);
_protector.Unprotect("encrypted-key").Returns("plain");
_slaveClient.GetRegisteredMasterUrlAsync(Arg.Any<string>(), Arg.Any<string>())
.Returns(RegisteredMasterUrlResult.Ok("<public-url-of-this-master-instance>"));
_slaveClient.RegisterMasterAsync(Arg.Any<string>(), Arg.Any<string>(), Arg.Any<string>()).Returns(true);
_httpContextAccessor.HttpContext.Returns((HttpContext?)null);
await CreateSut().VerifyIntegrityAsync(); // _options holds https://master.test
await _slaveClient.Received(1).RegisterMasterAsync(instance.Url, "plain", "https://master.test");
}
[Fact]
public async Task VerifyIntegrityAsync_SetsLastIntegrityCheckFailedAt_WhenSlaveUnreachable()
{