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
@@ -106,7 +106,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public async Task Der_vollstaendige_Rundlauf_stellt_alles_wieder_her()
|
||||
public async Task The_full_round_trip_restores_everything()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
@@ -140,7 +140,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Zugangsdaten_sind_nach_dem_Wiederherstellen_wieder_nutzbar()
|
||||
public async Task Credentials_are_usable_again_after_restoring()
|
||||
{
|
||||
// The actual purpose of the passphrase: a backup is needed when the
|
||||
// machine is broken — DPAPI-protected values would then be unreadable.
|
||||
@@ -173,27 +173,27 @@ public sealed class BackupServiceTests : IDisposable
|
||||
/// the test would be green without proving anything.</para>
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task Der_Umzug_auf_einen_anderen_Rechner_traegt()
|
||||
public async Task The_move_to_another_machine_holds()
|
||||
{
|
||||
var zielMaschine = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
var targetMachine = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
|
||||
try
|
||||
{
|
||||
// Machine 1: values lie under the local key.
|
||||
await BuildInstanceAsync();
|
||||
var schluesselDerQuelle = File.ReadAllBytes(SecretKeyStore.KeyFilePath);
|
||||
var sourceKey = File.ReadAllBytes(SecretKeyStore.KeyFilePath);
|
||||
|
||||
await _service.CreateAsync(_instanceDir, ZipPath,
|
||||
new BackupOptions { Secrets = SecretMode.Passphrase, Passphrase = "umzug" });
|
||||
|
||||
// Machine 2: different machine, different key. The key does not travel
|
||||
// along — it deliberately lies outside the instance directory.
|
||||
SecretKeyStore.UseDirectory(zielMaschine);
|
||||
SecretKeyStore.UseDirectory(targetMachine);
|
||||
|
||||
await _service.RestoreAsync(ZipPath, RestoreDir, new RestoreOptions { Passphrase = "umzug" });
|
||||
|
||||
File.ReadAllBytes(SecretKeyStore.KeyFilePath)
|
||||
.ShouldNotBe(schluesselDerQuelle, "sonst wäre es derselbe Rechner");
|
||||
.ShouldNotBe(sourceKey, "sonst wäre es derselbe Rechner");
|
||||
|
||||
var settings = JsonDocument.Parse(
|
||||
File.ReadAllText(Path.Combine(RestoreDir, "InstanceSettings.json")));
|
||||
@@ -217,18 +217,18 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// user key must certainly not be it.
|
||||
SecretKeyStore.UseDirectory(
|
||||
Path.Combine(Path.GetTempPath(), "clawd-tests", "keys", Guid.NewGuid().ToString("N")));
|
||||
try { Directory.Delete(zielMaschine, recursive: true); } catch { /* secondary */ }
|
||||
try { Directory.Delete(targetMachine, recursive: true); } catch { /* secondary */ }
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ohne_die_Passphrase_ist_der_Umzug_verloren()
|
||||
public async Task Without_the_passphrase_the_move_is_lost()
|
||||
{
|
||||
// The flip side, and the reason why the passphrase has to be offered when backing
|
||||
// up: without it a backup on the target machine is worthless as far as the
|
||||
// credentials are concerned. That is not an error, but the price for the
|
||||
// key not travelling along — but it has to be noticed instead of happening silently.
|
||||
var zielMaschine = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
var targetMachine = Path.Combine(Path.GetTempPath(), "clawd-tests", Guid.NewGuid().ToString("N"));
|
||||
|
||||
try
|
||||
{
|
||||
@@ -237,7 +237,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
await _service.CreateAsync(_instanceDir, ZipPath,
|
||||
new BackupOptions { Secrets = SecretMode.Passphrase, Passphrase = "umzug" });
|
||||
|
||||
SecretKeyStore.UseDirectory(zielMaschine);
|
||||
SecretKeyStore.UseDirectory(targetMachine);
|
||||
|
||||
await Should.ThrowAsync<Exception>(
|
||||
() => _service.RestoreAsync(ZipPath, RestoreDir, new RestoreOptions { Passphrase = "falsch" }));
|
||||
@@ -246,12 +246,12 @@ public sealed class BackupServiceTests : IDisposable
|
||||
{
|
||||
SecretKeyStore.UseDirectory(
|
||||
Path.Combine(Path.GetTempPath(), "clawd-tests", "keys", Guid.NewGuid().ToString("N")));
|
||||
try { Directory.Delete(zielMaschine, recursive: true); } catch { /* secondary */ }
|
||||
try { Directory.Delete(targetMachine, recursive: true); } catch { /* secondary */ }
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Auch_verschachtelte_Zugangsdaten_in_Tool_Konfigurationen_kommen_zurueck()
|
||||
public async Task Nested_credentials_in_tool_configurations_come_back_too()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
@@ -269,7 +269,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Unbekannte_Felder_ueberstehen_den_Rundlauf()
|
||||
public async Task Unknown_fields_survive_the_round_trip()
|
||||
{
|
||||
// A backup must not throw anything away just because a program version does not know
|
||||
// a field.
|
||||
@@ -288,7 +288,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public async Task Ohne_Zugangsdaten_enthaelt_das_Archiv_keine_Geheimnisse()
|
||||
public async Task Without_credentials_the_archive_contains_no_secrets()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
@@ -296,25 +296,25 @@ public sealed class BackupServiceTests : IDisposable
|
||||
new BackupOptions { Secrets = SecretMode.Exclude });
|
||||
|
||||
// Search the entire archive in plain text.
|
||||
var inhalt = ReadWholeArchive(ZipPath);
|
||||
var content = ReadWholeArchive(ZipPath);
|
||||
|
||||
inhalt.ShouldNotContain(ApiKeyPlain);
|
||||
inhalt.ShouldNotContain(MailPasswordPlain);
|
||||
content.ShouldNotContain(ApiKeyPlain);
|
||||
content.ShouldNotContain(MailPasswordPlain);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Eine_Sicherung_mit_Passphrase_zeigt_die_Geheimnisse_nicht_im_Klartext()
|
||||
public async Task A_backup_with_passphrase_does_not_show_the_secrets_in_plaintext()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
await _service.CreateAsync(_instanceDir, ZipPath,
|
||||
new BackupOptions { Secrets = SecretMode.Passphrase, Passphrase = "geheim" });
|
||||
|
||||
var inhalt = ReadWholeArchive(ZipPath);
|
||||
var content = ReadWholeArchive(ZipPath);
|
||||
|
||||
inhalt.ShouldNotContain(ApiKeyPlain);
|
||||
inhalt.ShouldNotContain(MailPasswordPlain);
|
||||
inhalt.ShouldContain("pbe:v1:");
|
||||
content.ShouldNotContain(ApiKeyPlain);
|
||||
content.ShouldNotContain(MailPasswordPlain);
|
||||
content.ShouldContain("pbe:v1:");
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
@@ -322,7 +322,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public async Task Das_Manifest_beschreibt_die_Sicherung()
|
||||
public async Task The_manifest_describes_the_backup()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
@@ -340,7 +340,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ohne_Passphrase_wird_nicht_wiederhergestellt()
|
||||
public async Task Without_passphrase_nothing_is_restored()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath,
|
||||
@@ -353,7 +353,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Eine_falsche_Passphrase_wird_erkannt()
|
||||
public async Task A_wrong_passphrase_is_recognised()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath,
|
||||
@@ -364,7 +364,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ein_veraendertes_Archiv_faellt_auf()
|
||||
public async Task A_modified_archive_is_noticed()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions());
|
||||
@@ -386,15 +386,15 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ein_Archiv_ohne_Manifest_wird_abgelehnt()
|
||||
public async Task An_archive_without_manifest_is_rejected()
|
||||
{
|
||||
var fremd = Path.Combine(_root, "fremd.zip");
|
||||
var quelle = Path.Combine(_root, "quelle");
|
||||
Directory.CreateDirectory(quelle);
|
||||
File.WriteAllText(Path.Combine(quelle, "irgendwas.txt"), "Inhalt");
|
||||
ZipFile.CreateFromDirectory(quelle, fremd);
|
||||
var foreign = Path.Combine(_root, "fremd.zip");
|
||||
var source = Path.Combine(_root, "quelle");
|
||||
Directory.CreateDirectory(source);
|
||||
File.WriteAllText(Path.Combine(source, "irgendwas.txt"), "Inhalt");
|
||||
ZipFile.CreateFromDirectory(source, foreign);
|
||||
|
||||
var ex = await Should.ThrowAsync<BackupException>(() => _service.InspectAsync(fremd));
|
||||
var ex = await Should.ThrowAsync<BackupException>(() => _service.InspectAsync(foreign));
|
||||
|
||||
ex.Message.ShouldContain("Manifest");
|
||||
}
|
||||
@@ -404,7 +404,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public async Task Die_Vorschau_schreibt_nichts()
|
||||
public async Task The_preview_writes_nothing()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions());
|
||||
@@ -417,35 +417,35 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Vorhandene_Dateien_werden_ohne_Zustimmung_nicht_ueberschrieben()
|
||||
public async Task Existing_files_are_not_overwritten_without_consent()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions());
|
||||
|
||||
Directory.CreateDirectory(RestoreDir);
|
||||
var vorhanden = Path.Combine(RestoreDir, "InstanceSettings.json");
|
||||
AtomicFile.WriteAllText(vorhanden, """{"wichtig":"nicht verlieren"}""");
|
||||
var present = Path.Combine(RestoreDir, "InstanceSettings.json");
|
||||
AtomicFile.WriteAllText(present, """{"wichtig":"nicht verlieren"}""");
|
||||
|
||||
var result = await _service.RestoreAsync(ZipPath, RestoreDir, new RestoreOptions());
|
||||
|
||||
result.HasConflicts.ShouldBeTrue();
|
||||
result.Skipped.ShouldContain("InstanceSettings.json");
|
||||
File.ReadAllText(vorhanden).ShouldContain("nicht verlieren");
|
||||
File.ReadAllText(present).ShouldContain("nicht verlieren");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Mit_Zustimmung_wird_ueberschrieben()
|
||||
public async Task With_consent_it_is_overwritten()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions());
|
||||
|
||||
Directory.CreateDirectory(RestoreDir);
|
||||
var vorhanden = Path.Combine(RestoreDir, "InstanceSettings.json");
|
||||
AtomicFile.WriteAllText(vorhanden, """{"alt":true}""");
|
||||
var present = Path.Combine(RestoreDir, "InstanceSettings.json");
|
||||
AtomicFile.WriteAllText(present, """{"alt":true}""");
|
||||
|
||||
await _service.RestoreAsync(ZipPath, RestoreDir, new RestoreOptions { Overwrite = true });
|
||||
|
||||
File.ReadAllText(vorhanden).ShouldContain("Testinstanz");
|
||||
File.ReadAllText(present).ShouldContain("Testinstanz");
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
@@ -453,7 +453,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
|
||||
[Fact]
|
||||
public async Task Protokolle_bleiben_standardmaessig_aussen_vor()
|
||||
public async Task Logs_are_left_out_by_default()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions());
|
||||
@@ -464,7 +464,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Protokolle_lassen_sich_einschliessen()
|
||||
public async Task Logs_can_be_included()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
await _service.CreateAsync(_instanceDir, ZipPath, new BackupOptions { IncludeLogs = true });
|
||||
@@ -475,7 +475,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Die_WAL_Begleitdateien_landen_nicht_im_Archiv()
|
||||
public async Task The_WAL_side_files_do_not_end_up_in_the_archive()
|
||||
{
|
||||
// VACUUM INTO already incorporates them — backing them up too would be misleading.
|
||||
await BuildInstanceAsync();
|
||||
@@ -488,7 +488,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Ein_fehlendes_Instanzverzeichnis_wird_gemeldet()
|
||||
public async Task A_missing_instance_directory_is_reported()
|
||||
{
|
||||
var ex = await Should.ThrowAsync<BackupException>(
|
||||
() => _service.CreateAsync(Path.Combine(_root, "gibtsnicht"), ZipPath, new BackupOptions()));
|
||||
@@ -497,7 +497,7 @@ public sealed class BackupServiceTests : IDisposable
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Passphrase_Modus_ohne_Passphrase_wird_abgelehnt()
|
||||
public async Task Passphrase_mode_without_passphrase_is_rejected()
|
||||
{
|
||||
await BuildInstanceAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user