Cartella dei dati in rete: la prova vale anche su Windows

La prova iniettava una tabella dei montaggi di Linux (cifs), che su Windows non esiste: lì il
controllo riconosce la rete dai percorsi UNC e dalle unità di rete, quindi il server partiva
normalmente e la prova falliva. Ora su Windows la cartella dei dati è un percorso UNC verso un
nome .invalid, riconosciuto dalla sola forma senza interrogare la rete; su Linux la prova è
quella di prima. Il prodotto era già giusto: cambia solo la prova.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-20 13:09:07 +02:00
1 parent d9d8a296b1
commit e035cfd20a
2 files changed
+14 -4

No files matched your search

+13 -4
View File
@@ -99,14 +99,23 @@ public sealed class StartupProblemTests
[TestMethod]
public async Task ADataFolderOnANetworkShareIsRefused()
{
// A share shows itself differently on the two systems: on Linux as a cifs mount in the mount table (injected
// here), on Windows as a UNC path, recognised from its form before anything touches it. The Windows server name
// ends in .invalid (RFC 6761): no machine answers to it, and nothing here looks it up.
using var temp = new TempFolder("server-problemi");
var data = temp.Combine("dati");
var windows = OperatingSystem.IsWindows();
var data = windows ? @"\\febe-prova.invalid\condivisa\dati" : temp.Combine("dati");
var mounts = $"/dev/sda1 / ext4 rw 0 0\n//nas/condivisa {temp.Path} cifs rw 0 0\n";
await using var server = await FebeServer.StartAsync(Options(temp), Hooks() with { DataFolderCheck = new DataFolderCheck(() => mounts) });
await using var server = await FebeServer.StartAsync(Options(temp) with { DataFolder = data }, Hooks() with { DataFolderCheck = new DataFolderCheck(() => mounts) });
var problem = server.Problems.Single();
Assert.AreEqual(StartupChecks.DataOnNetwork, problem.Code);
StringAssert.Contains(problem.Message, "cifs");
Assert.IsFalse(Directory.Exists(Path.Combine(data, "registro")));
StringAssert.Contains(problem.Message, windows ? "condivisione di rete" : "cifs");
if (!windows)
{
// Nothing written in the Data folder (on Windows the share does not exist: looking would mean asking the network).
Assert.IsFalse(Directory.Exists(Path.Combine(data, "registro")));
}
using var client = Client(server);
await AssertHealthAsync(client, HttpStatusCode.ServiceUnavailable, """{"stato":"problema"}""");
}