Skip to content

Commit 0e20297

Browse files
committed
improving GetHostSecrets test
1 parent dd8b7b5 commit 0e20297

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

test/WebJobs.Script.Tests/Security/SecretManagerTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,14 +572,17 @@ public async Task GetHostSecrets_WhenTooManyBackups_ThrowsException()
572572
{
573573
await Assert.ThrowsAsync<InvalidOperationException>(async () =>
574574
{
575-
for (int i = 0; i < ScriptConstants.MaximumSecretBackupCount + 10; i++)
575+
for (int i = 0; i < ScriptConstants.MaximumSecretBackupCount + 20; i++)
576576
{
577577
File.WriteAllText(Path.Combine(directory.Path, functionName + ".json"), functionSecretsJson);
578-
functionSecrets = await secretManager.GetFunctionSecretsAsync(functionName);
579-
if (i > ScriptConstants.MaximumSecretBackupCount)
578+
579+
// If we haven't hit the exception yet, pause to ensure the file contents are being flushed.
580+
if (i >= ScriptConstants.MaximumSecretBackupCount)
580581
{
581582
await Task.Delay(500);
582583
}
584+
585+
functionSecrets = await secretManager.GetFunctionSecretsAsync(functionName);
583586
}
584587
});
585588
}

0 commit comments

Comments
 (0)