Stufe 4c (#764): Bezeichner auf Englisch - Typen, Methoden, Felder, Parameter, Locals, Testnamen
Mit Roslyn umbenannt (Verweise folgen, Zeichenketten bleiben unberuehrt). Nicht umbenannt, weil gespeichert oder ueber die API gebunden (Stufe 4e): Properties, Record-Parameter, Enum-Member sowie die Parameter der Endpunkt-Handler (Routen-/Query-Bindung ueber den Namen). Die JSON-Felder anonymer Objekte bleiben ausdruecklich benannt (JsonFilter: pfad). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
837a634a22
commit
77062facc9
@@ -21,7 +21,7 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Eine_fehlende_Datei_wird_mit_Vorgaben_angelegt()
|
||||
public void A_missing_file_is_created_with_defaults()
|
||||
{
|
||||
var store = new ManagerSettingsStore(_dir);
|
||||
var settings = store.Load();
|
||||
@@ -36,7 +36,7 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
/// runtime, otherwise nobody could work with them.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Geheimnisse_stehen_nicht_im_Klartext_in_der_Datei()
|
||||
public void Secrets_are_not_in_plaintext_in_the_file()
|
||||
{
|
||||
var store = new ManagerSettingsStore(_dir);
|
||||
store.Load();
|
||||
@@ -48,9 +48,9 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
File.ReadAllText(store.SettingsPath).ShouldNotContain("dc_master_geheim_1234567890");
|
||||
File.ReadAllText(store.SettingsPath).ShouldNotContain("LIZ-1234-5678");
|
||||
|
||||
var erneut = new ManagerSettingsStore(_dir).Load();
|
||||
erneut.DeploymentcenterMasterToken.ShouldBe("dc_master_geheim_1234567890");
|
||||
erneut.LicenseKey.ShouldBe("LIZ-1234-5678");
|
||||
var again = new ManagerSettingsStore(_dir).Load();
|
||||
again.DeploymentcenterMasterToken.ShouldBe("dc_master_geheim_1234567890");
|
||||
again.LicenseKey.ShouldBe("LIZ-1234-5678");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -61,13 +61,13 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
/// with defaults. This test clarifies whether that was due to the file.</para>
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Eine_Datei_mit_Byte_Order_Mark_gilt_auch()
|
||||
public void A_file_with_byte_order_mark_counts_too()
|
||||
{
|
||||
var pfad = Path.Combine(_dir, "manager.json");
|
||||
var path = Path.Combine(_dir, "manager.json");
|
||||
|
||||
// Exactly as PowerShell writes it: with BOM, with double spaces after
|
||||
// the colon, and with doubled backslashes in the path.
|
||||
var inhalt = """
|
||||
var content = """
|
||||
{
|
||||
"instanceExecutable": "J:\\Programme\\ClawdDotNet.exe",
|
||||
"webUiPort": 7009,
|
||||
@@ -75,8 +75,8 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
}
|
||||
""";
|
||||
|
||||
File.WriteAllText(pfad, inhalt, new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: true));
|
||||
File.ReadAllBytes(pfad)[0].ShouldBe((byte)0xEF, "Der Test braucht das BOM.");
|
||||
File.WriteAllText(path, content, new System.Text.UTF8Encoding(encoderShouldEmitUTF8Identifier: true));
|
||||
File.ReadAllBytes(path)[0].ShouldBe((byte)0xEF, "Der Test braucht das BOM.");
|
||||
|
||||
var store = new ManagerSettingsStore(_dir);
|
||||
var settings = store.Load();
|
||||
@@ -92,7 +92,7 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
/// no instance would run at all, and that is the worse state.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Eine_kaputte_Datei_verhindert_den_Start_nicht()
|
||||
public void A_broken_file_does_not_prevent_the_start()
|
||||
{
|
||||
File.WriteAllText(Path.Combine(_dir, "manager.json"), "{ das ist kein JSON");
|
||||
|
||||
@@ -111,7 +111,7 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
/// alarm at every hiccup.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Unsinnige_Aufsichtswerte_werden_eingefangen()
|
||||
public void Nonsensical_supervision_values_are_caught()
|
||||
{
|
||||
var settings = new ManagerSettings
|
||||
{
|
||||
@@ -133,30 +133,30 @@ public sealed class ManagerSettingsTests : IDisposable
|
||||
/// <summary>The log excerpt that only gives a crash report its value.</summary>
|
||||
public sealed class InstanceLogExcerptTests : IDisposable
|
||||
{
|
||||
private readonly string _instanz = Path.Combine(
|
||||
private readonly string _instance = Path.Combine(
|
||||
Path.GetTempPath(), "clawd-tests", "log-" + Guid.NewGuid().ToString("N")[..8]);
|
||||
|
||||
public InstanceLogExcerptTests() => Directory.CreateDirectory(_instanz);
|
||||
public InstanceLogExcerptTests() => Directory.CreateDirectory(_instance);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try { Directory.Delete(_instanz, recursive: true); }
|
||||
try { Directory.Delete(_instance, recursive: true); }
|
||||
catch { /* A leftover test folder does not turn a run red. */ }
|
||||
}
|
||||
|
||||
private void Schreibe(string tag, string modul, params string[] zeilen)
|
||||
private void Write(string tag, string module, params string[] lines)
|
||||
{
|
||||
var dir = Path.Combine(_instanz, "Logs", tag);
|
||||
var dir = Path.Combine(_instance, "Logs", tag);
|
||||
Directory.CreateDirectory(dir);
|
||||
File.WriteAllLines(Path.Combine(dir, modul), zeilen);
|
||||
File.WriteAllLines(Path.Combine(dir, module), lines);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ohne_Protokoll_kommt_nichts_zurueck()
|
||||
public void Without_log_nothing_comes_back()
|
||||
{
|
||||
// Not an error, but a finding: a process that was killed before its
|
||||
// write buffer was flushed leaves exactly nothing (#529).
|
||||
InstanceLogExcerpt.Read(_instanz).ShouldBeEmpty();
|
||||
InstanceLogExcerpt.Read(_instance).ShouldBeEmpty();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -165,42 +165,42 @@ public sealed class InstanceLogExcerptTests : IDisposable
|
||||
/// next.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Die_Module_werden_nach_Zeit_zusammengefuehrt()
|
||||
public void The_modules_are_merged_by_time()
|
||||
{
|
||||
Schreibe("2026-09-08", "Startup.log",
|
||||
Write("2026-09-08", "Startup.log",
|
||||
"[17:26:48.100] [INF] Instanz Test2 angelegt",
|
||||
"[17:26:50.900] [INF] Application is shutting down");
|
||||
|
||||
Schreibe("2026-09-08", "Web.log",
|
||||
Write("2026-09-08", "Web.log",
|
||||
"[17:26:49.500] [INF] Weboberfläche beendet");
|
||||
|
||||
var zeilen = InstanceLogExcerpt.Read(_instanz);
|
||||
var lines = InstanceLogExcerpt.Read(_instance);
|
||||
|
||||
zeilen.Count.ShouldBe(3);
|
||||
zeilen[0].ShouldContain("17:26:48");
|
||||
zeilen[1].ShouldContain("17:26:49");
|
||||
zeilen[2].ShouldContain("17:26:50");
|
||||
lines.Count.ShouldBe(3);
|
||||
lines[0].ShouldContain("17:26:48");
|
||||
lines[1].ShouldContain("17:26:49");
|
||||
lines[2].ShouldContain("17:26:50");
|
||||
|
||||
// Which file a line comes from is part of it.
|
||||
zeilen[1].ShouldStartWith("Web.log:");
|
||||
lines[1].ShouldStartWith("Web.log:");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Nur_der_juengste_Tag_zaehlt()
|
||||
public void Only_the_most_recent_day_counts()
|
||||
{
|
||||
Schreibe("2026-09-01", "Startup.log", "[10:00:00.000] [INF] uralt");
|
||||
Schreibe("2026-09-08", "Startup.log", "[10:00:00.000] [INF] frisch");
|
||||
Write("2026-09-01", "Startup.log", "[10:00:00.000] [INF] uralt");
|
||||
Write("2026-09-08", "Startup.log", "[10:00:00.000] [INF] frisch");
|
||||
|
||||
InstanceLogExcerpt.Read(_instanz).ShouldHaveSingleItem().ShouldContain("frisch");
|
||||
InstanceLogExcerpt.Read(_instance).ShouldHaveSingleItem().ShouldContain("frisch");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Es_werden_nur_die_letzten_Zeilen_genommen()
|
||||
public void Only_the_last_lines_are_taken()
|
||||
{
|
||||
Schreibe("2026-09-08", "Startup.log",
|
||||
Write("2026-09-08", "Startup.log",
|
||||
Enumerable.Range(0, 500).Select(i => $"[10:00:{i % 60:00}.000] [INF] Zeile {i}").ToArray());
|
||||
|
||||
InstanceLogExcerpt.Read(_instanz, lines: 10).Count.ShouldBeLessThanOrEqualTo(10);
|
||||
InstanceLogExcerpt.Read(_instance, lines: 10).Count.ShouldBeLessThanOrEqualTo(10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -208,33 +208,33 @@ public sealed class InstanceLogExcerptTests : IDisposable
|
||||
/// that is just ending. Whoever wanted to open it exclusively might get nothing at all.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Eine_offen_beschriebene_Datei_laesst_sich_lesen()
|
||||
public void A_file_open_for_writing_can_be_read()
|
||||
{
|
||||
Schreibe("2026-09-08", "Startup.log", "[10:00:00.000] [INF] erste Zeile");
|
||||
Write("2026-09-08", "Startup.log", "[10:00:00.000] [INF] erste Zeile");
|
||||
|
||||
var pfad = Path.Combine(_instanz, "Logs", "2026-09-08", "Startup.log");
|
||||
var path = Path.Combine(_instance, "Logs", "2026-09-08", "Startup.log");
|
||||
|
||||
using var offen = new FileStream(
|
||||
pfad, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
|
||||
using var open = new FileStream(
|
||||
path, FileMode.Append, FileAccess.Write, FileShare.ReadWrite);
|
||||
|
||||
InstanceLogExcerpt.Read(_instanz).ShouldNotBeEmpty();
|
||||
InstanceLogExcerpt.Read(_instance).ShouldNotBeEmpty();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Ein_eigenes_Protokollverzeichnis_wird_beachtet()
|
||||
public void A_custom_log_directory_is_respected()
|
||||
{
|
||||
var eigen = Path.Combine(_instanz, "AndereLogs");
|
||||
Directory.CreateDirectory(Path.Combine(eigen, "2026-09-08"));
|
||||
var own = Path.Combine(_instance, "AndereLogs");
|
||||
Directory.CreateDirectory(Path.Combine(own, "2026-09-08"));
|
||||
File.WriteAllLines(
|
||||
Path.Combine(eigen, "2026-09-08", "Startup.log"),
|
||||
Path.Combine(own, "2026-09-08", "Startup.log"),
|
||||
["[10:00:00.000] [INF] woanders"]);
|
||||
|
||||
var config = new ClawdDotNet.Core.Config.InstanceConfig
|
||||
{
|
||||
WorkingDirectory = _instanz,
|
||||
WorkingDirectory = _instance,
|
||||
LogDirectory = "AndereLogs"
|
||||
};
|
||||
|
||||
InstanceLogExcerpt.Read(_instanz, config).ShouldHaveSingleItem().ShouldContain("woanders");
|
||||
InstanceLogExcerpt.Read(_instance, config).ShouldHaveSingleItem().ShouldContain("woanders");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user