Misura delle prestazioni dell'interfaccia con 60 aste (#34)
I criteri della specifica §9.11 (frame, blocchi del thread, riga aggiornata entro 100 ms, riconnessione sotto i 2 s, nessun ridisegno della griglia con maniglie e finestra) non li misurava nessuno. Ora il simulatore prende --simulatore-aste N (solo con --simulatore): N aste in elenco, tre su quattro in Attiva, ciclo di 5 s e due autopuntate senza fine per asta, così almeno dieci aste stanno sempre sotto i 4 s; senza l'argomento il simulatore resta quello di sempre. tools/Mimante.Schermate ha la modalità --misura <secondi>, tutta via CDP: uno script nella pagina cronometra frame, compiti dell'interfaccia (timer, frame, eventi del puntatore, ResizeObserver) e messaggi del bot, chiude il canale per la riconnessione, trascina la maniglia e ridimensiona la finestra controllando che i <tr data-id> restino gli stessi nodi, che la griglia non scorra né si virtualizzi e che anche lì nessun compito blocchi il thread; scrive misura.json e misura.txt ed esce con 1 se un criterio vincolante fallisce (anche un solo compito lungo del browser) o la misura non vale (basta un campione con meno di dieci aste in finestra critica; la CPU si riporta soltanto). La password può venire da UI_PASSWORD. prove-a-mano.yml ha il lavoro «prestazioni», dopo carico e schermate per non dividere la CPU, e il commento sul mondo del simulatore è corretto. Le prove dei conti della misura stanno in tests/Mimante.Tests con un riferimento a tools/Mimante.Schermate che esiste solo se la cartella c'è: il contesto dell'immagine non ha tools/ e lì quelle prove restano fuori, così la costruzione dell'immagine non si rompe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ea6ba27462
commit
d84d396f86
19 files changed
+1812
-43
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Mimante.Tests.Packaging;
|
||||
@@ -119,6 +120,15 @@ public sealed partial class PipelineTests
|
||||
Assert.Contains("--simulatore", Job(workflow, "schermate"));
|
||||
Assert.DoesNotContain("--simulatore", Code(Job(workflow, "carico")));
|
||||
|
||||
// The performance trial (#34) runs alone after the others, with 60 simulated auctions, and gets the password of
|
||||
// the interface from UI_PASSWORD, never on its command line.
|
||||
var performance = Code(Job(workflow, "prestazioni"));
|
||||
Assert.Contains("needs: [carico, schermate]", performance);
|
||||
Assert.Contains("--simulatore --simulatore-aste 60", performance);
|
||||
Assert.Contains("Mimante.Schermate.dll http://localhost:8080 out/prestazioni --misura 120", performance);
|
||||
Assert.DoesNotContain("$UI_PASSWORD", performance);
|
||||
Assert.Contains("uses: actions/upload-artifact@v3", performance);
|
||||
|
||||
var load = Code(Script("prova-carico.sh"));
|
||||
Assert.Contains("docker network create --internal", load);
|
||||
Assert.Contains("--memory=1g", load);
|
||||
@@ -166,6 +176,43 @@ public sealed partial class PipelineTests
|
||||
Assert.StartsWith("#!/usr/bin/env bash", File.ReadAllText(file));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The build stage of docker/Dockerfile compiles tests/Mimante.Tests with only src/ and tests/ in the context
|
||||
/// (.dockerignore drops tools/): a reference of the test project outside those two folders must depend on the
|
||||
/// project being there, and the tests that need it must leave the compilation when it is not (issue #34).
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TheImageBuildsTheTestsWithoutTools()
|
||||
{
|
||||
var ignore = Read(".dockerignore").Split('\n').Select(l => l.Trim()).ToList();
|
||||
Assert.Contains("tools", ignore);
|
||||
var dockerfile = Read("docker", "Dockerfile");
|
||||
Assert.DoesNotContain("COPY tools", dockerfile);
|
||||
|
||||
var project = XDocument.Parse(Read("tests", "Mimante.Tests", "Mimante.Tests.csproj"));
|
||||
var properties = project.Descendants("PropertyGroup").Elements()
|
||||
.ToDictionary(e => e.Name.LocalName, e => e.Value, StringComparer.OrdinalIgnoreCase);
|
||||
string Expand(string value) =>
|
||||
Regex.Replace(value, @"\$\((?<p>[A-Za-z0-9_]+)\)", m => properties.GetValueOrDefault(m.Groups["p"].Value, m.Value));
|
||||
|
||||
foreach (var reference in project.Descendants("ProjectReference"))
|
||||
{
|
||||
var path = Expand((string?)reference.Attribute("Include") ?? "").Replace('\\', '/');
|
||||
var inContext = !path.StartsWith("../../", StringComparison.Ordinal)
|
||||
|| path.StartsWith("../../src/", StringComparison.Ordinal) || path.StartsWith("../../tests/", StringComparison.Ordinal);
|
||||
if (inContext) continue;
|
||||
var condition = Expand((string?)reference.Parent?.Attribute("Condition") ?? "").Replace('\\', '/');
|
||||
Assert.True(condition.Contains($"Exists('{path}')", StringComparison.Ordinal), $"{path}: reference without Exists(...)");
|
||||
var removed = project.Descendants("Compile")
|
||||
.Where(c => Expand((string?)c.Parent?.Attribute("Condition") ?? "").Replace('\\', '/') == $"!Exists('{path}')")
|
||||
.Select(c => (string?)c.Attribute("Remove"))
|
||||
.ToList();
|
||||
Assert.NotEmpty(removed);
|
||||
}
|
||||
Assert.Contains("Exists('../../tools/Mimante.Schermate/Mimante.Schermate.csproj')",
|
||||
Expand(Read("tests", "Mimante.Tests", "Mimante.Tests.csproj")).Replace('\\', '/'));
|
||||
}
|
||||
|
||||
// ---- helpers ----
|
||||
|
||||
private static string Workflow(string name) => Read(".gitea", "workflows", name);
|
||||
|
||||
Reference in new issue
Block a user