E2: prove del motore, dell'archivio e del servizio delle copie
Le prove della tappa E2 (WP5a) coprono il montaggio di /esporta, la radice, il controllo delle cartelle, le destinazioni, i percorsi, la copia, gli stati «Tolto» e «Superato», lo stesso post in due account, il lavoro in sottofondo (interrompi, riprendi, annulla, riavvio, porta condivisa con importazione e ricostruzione, sessione del motore, interruttore dell'account, Docker senza montaggio) e il filtro «Copie». Si appoggiano a un banco comune con falsi per disco, sessione, montaggi e file system, senza permessi dei file, così girano anche da root. Le prove hanno trovato due difetti, corretti: - MarkCopiesRemovedAsync riusava il comando in cache del primo blocco di 900 id: «Controlla le copie» falliva con più di 900 file mancanti in una pagina. - ReplacedStatesSql senza statistiche leggeva tutte le copie tolte o superate della destinazione: «+state» la tiene sul suo indice. Il controllo delle cartelle accetta una scrittura di prova sostituibile, per provare il guasto della sonda senza permessi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
31cfdac051
commit
736d241a38
18 files changed
+3124
-12
No files matched your search
@@ -1,6 +1,9 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Febe.Core.Abstractions;
|
||||
using Febe.Core.Domain;
|
||||
using Febe.Core.Export;
|
||||
using Febe.Core.Import;
|
||||
using Febe.Tests.Export.Support;
|
||||
using Febe.Tests.Import.Support;
|
||||
using Febe.Tests.Support;
|
||||
|
||||
@@ -120,4 +123,32 @@ public sealed class ImportServiceTests
|
||||
Assert.IsNull(await bed.Library.Db.Settings.GetAsync($"importazione.{run.Id}.ipotesi-stogram"));
|
||||
CollectionAssert.AreEqual(before.ToList(), bed.Fingerprint().ToList());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task AnImportDoesNotStartWhileAnExportRuns()
|
||||
{
|
||||
// A real copy to an external folder holds the gate shared by the import, the export and the rebuild (tappa E2).
|
||||
var held = new HeldExportFileSystem(path => path.EndsWith("_1.jpg", StringComparison.Ordinal));
|
||||
await using var export = await ExportTestBed.CreateAsync(env => env with { FileSystem = held });
|
||||
await export.PostAsync(export.Marta, "700", 1);
|
||||
await export.GeneralAsync();
|
||||
await export.Service.StartAsync(new ExportJobRequest(new ExportSelection.Account(export.Marta.Id)));
|
||||
await held.Reached.Task.WaitAsync(TimeSpan.FromSeconds(30));
|
||||
|
||||
using var temp = new TempFolder("importa");
|
||||
await using var bed = await ImportTestBed.CreateAsync(temp);
|
||||
bed.Write("marta.demo/a.jpg", ImportTestFiles.Photo(330, 200, 150));
|
||||
await using var service = new ImportService(bed.Environment with { Gate = export.Gate });
|
||||
var refused = await Assert.ThrowsExactlyAsync<InvalidOperationException>(() => service.StartAsync(bed.Source));
|
||||
Assert.AreEqual(LongWorkGate.BusyMessage(LongWorkKind.Import, LongWorkKind.Export), refused.Message);
|
||||
Assert.StartsWith("C'è una copia nelle cartelle esterne al lavoro", refused.Message);
|
||||
Assert.IsEmpty(await service.ListRunsAsync(), "a refused import records nothing");
|
||||
|
||||
// The copy ends: the import starts.
|
||||
held.Release();
|
||||
await export.Service.WaitAsync();
|
||||
Assert.IsNull(export.Gate.Busy);
|
||||
var run = await service.StartAsync(bed.Source);
|
||||
Assert.AreEqual(ImportRunState.Reviewing, (await service.WaitAsync(run.Id))!.State);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user