test(secrets-cli): structural no-plaintext assert (base64 '+' JSON-escaping flake) + override doc note

This commit is contained in:
Joseph Doherty
2026-07-19 09:46:26 -04:00
parent 779f8a8d78
commit 6ad710bdbd
2 changed files with 10 additions and 3 deletions
@@ -239,11 +239,15 @@ public sealed class BundleServiceTests : IDisposable
string raw = await File.ReadAllTextAsync(BundlePath, CancellationToken.None);
Assert.DoesNotContain(sentinel, raw, StringComparison.Ordinal);
// The base64 ciphertext of the sealed row is present in the file.
// The base64 ciphertext of the sealed row is present in the file. Assert structurally through
// the codec rather than by raw-text match: System.Text.Json escapes '+' as +, so a raw
// Contains on the base64 string is flaky whenever the ciphertext base64 contains a '+'.
StoredSecret? row = await source.Store.GetAsync(new SecretName("svc/secret"), CancellationToken.None);
Assert.NotNull(row);
Assert.Contains(Convert.ToBase64String(row!.Ciphertext), raw, StringComparison.Ordinal);
Assert.Contains("\"Ciphertext\"", raw, StringComparison.Ordinal);
SecretBundle parsed = SecretBundleCodec.Deserialize(raw);
BundleEntry parsedEntry = Assert.Single(parsed.Entries);
Assert.Equal(Convert.ToBase64String(row!.Ciphertext), parsedEntry.Ciphertext);
}
[Fact]