test(secrets-cli): structural no-plaintext assert (base64 '+' JSON-escaping flake) + override doc note
This commit is contained in:
+6
-2
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user