E2: correzioni della revisione delle copie esterne
- Nome libero scelto prima di scrivere, libero sul disco e nel database; una riga orfana sul nome diventa «Tolto» (guardando il suo percorso, anche se differisce solo per le maiuscole): prima la copia finiva «Non riuscito» con il file già scritto, o toglieva la copia buona. - «Controlla le copie» rilegge la radice e riguarda i file mancanti; con il disco staccato si ferma e mette in pausa senza segnare nulla. - Su Linux lo spostamento sul nome finale non sostituisce mai un file (renameat2 RENAME_NOREPLACE, poi link e unlink). - Le copie in coda di un lavoro interrotto diventano «Interrotta» e si riprendono; il permesso dei lavori lunghi si tiene già nel piano. - «Superato» con il file di nuovo in libreria: filtro, piano e «Copia di nuovo» d'accordo; l'adozione ravviva la riga invece di fallire. - «Una copia sola» con una regola sola in filtro, piano, visualizzatore e copiatore (solo copie di un altro account in cartelle in uso). - Controllo della cartella per identità vera (percorso finale, realpath, dispositivo di mountinfo): riconosce collegamenti e bind mount di una sottocartella della libreria. - Sfoglia delle cartelle con tempi massimi; «Nessuna cartella» solo se non ce n'è; «In copia…» nel visualizzatore; numero e fuoco stabili in «Copia di nuovo anche…»; una sola lettura per volta nella Dashboard. - Prove dell'interfaccia indipendenti dall'ora e dal file scelto; prove nuove in ExportReviewTests, ExportFolderCheckTests, ExportRootTests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28c7f814b1
commit
36ad5c6f9d
28 files changed
+1314
-112
No files matched your search
@@ -178,6 +178,68 @@ public sealed class ExportFolderCheckTests
|
||||
Assert.IsEmpty(Fingerprint.Temporaries(temp.Path));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ALinkToAFolderInsideTheLibraryIsRecognised()
|
||||
{
|
||||
var ct = TestContext.CancellationToken;
|
||||
using var temp = new TempFolder();
|
||||
var library = temp.Combine("libreria");
|
||||
var inner = Path.Combine(library, "copie", "usb");
|
||||
Directory.CreateDirectory(inner);
|
||||
|
||||
// Not an account folder: a plain folder deep in the library, reached by a link (a junction or a symbolic link
|
||||
// where the test may make one, else the «\\?\» form of its path on Windows).
|
||||
var alias = temp.Combine("alias-copie");
|
||||
try
|
||||
{
|
||||
Directory.CreateSymbolicLink(alias, inner);
|
||||
}
|
||||
catch (Exception ex) when (OperatingSystem.IsWindows() && ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
alias = @"\\?\" + Path.GetFullPath(inner);
|
||||
}
|
||||
|
||||
Assert.IsFalse(ExportPaths.IsSameOrInside(alias, library), "the text must not tell");
|
||||
var guarded = new ExportFolderContext([new(Path.GetFullPath(library), ProtectedFolderKind.Library, null)], ExportRootOptions.AnyFolder);
|
||||
var verdict = await Check().CheckAsync(alias, guarded, ct);
|
||||
Assert.AreEqual(ExportFolderProblemKind.InsideProtected, verdict.Problem!.Kind);
|
||||
StringAssert.Contains(verdict.Problem.Message, "è dentro la cartella della libreria");
|
||||
Assert.IsEmpty(Fingerprint.Temporaries(temp.Path));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task ABindMountOfAFolderOfTheLibraryIsRecognised()
|
||||
{
|
||||
var ct = TestContext.CancellationToken;
|
||||
using var temp = new TempFolder();
|
||||
|
||||
// Docker on Unraid: -v /mnt/user/Febe:/libreria and -v /mnt/user/Febe/copie:/esporta/usb. Two folders that no
|
||||
// path and no probe relate, on the same device, the second showing a folder inside the first.
|
||||
var library = temp.Combine("libreria");
|
||||
var usb = temp.Combine("esporta", "usb");
|
||||
var nas = temp.Combine("esporta", "nas");
|
||||
var other = temp.Combine("esporta", "altro");
|
||||
foreach (var folder in new[] { library, usb, nas, Path.Combine(nas, "Febe", "lib"), other })
|
||||
{
|
||||
Directory.CreateDirectory(folder);
|
||||
}
|
||||
|
||||
string Real(string path) => FolderIdentity.RealPath(path)!;
|
||||
var mounts = new FixedMounts(
|
||||
new ExportMount(Real(library), "/Febe", "fuse.shfs", false, "0:51"),
|
||||
new ExportMount(Real(usb), "/Febe/copie", "fuse.shfs", false, "0:51"),
|
||||
new ExportMount(Real(nas), "/condivisa", "cifs", false, "0:60"),
|
||||
new ExportMount(Real(Path.Combine(nas, "Febe", "lib")), "/Febe", "fuse.shfs", false, "0:51"), // the library again, below the NAS
|
||||
new ExportMount(Real(other), "/Altro", "fuse.shfs", false, "0:51"));
|
||||
var check = new ExportFolderCheck(mounts);
|
||||
var guarded = new ExportFolderContext([new(Path.GetFullPath(library), ProtectedFolderKind.Library, null)], ExportRootOptions.AnyFolder with { Mounts = mounts });
|
||||
|
||||
Assert.AreEqual(ExportFolderProblemKind.InsideProtected, (await check.CheckAsync(usb, guarded, ct)).Problem!.Kind);
|
||||
Assert.AreEqual(ExportFolderProblemKind.ContainsProtected, (await check.CheckAsync(nas, guarded, ct)).Problem!.Kind, "a mount below the candidate shows the library");
|
||||
Assert.IsTrue((await check.CheckAsync(other, guarded, ct)).Accepted, "another folder of the same device is not the library");
|
||||
Assert.IsEmpty(Fingerprint.Temporaries(temp.Path));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task TheProbeIsWrittenOnlyInTheCandidate()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user