Skip to content

Commit a58302a

Browse files
committed
improving GetHostSecrets test
1 parent b781b27 commit a58302a

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
@@ -615,14 +615,17 @@ public async Task GetHostSecrets_WhenTooManyBackups_ThrowsException()
615615
InvalidOperationException ioe = null;
616616
try
617617
{
618-
for (int i = 0; i < ScriptConstants.MaximumSecretBackupCount + 10; i++)
618+
for (int i = 0; i < ScriptConstants.MaximumSecretBackupCount + 20; i++)
619619
{
620620
File.WriteAllText(Path.Combine(directory.Path, functionName + ".json"), functionSecretsJson);
621-
functionSecrets = await secretManager.GetFunctionSecretsAsync(functionName);
622-
if (i > ScriptConstants.MaximumSecretBackupCount)
621+
622+
// If we haven't hit the exception yet, pause to ensure the file contents are being flushed.
623+
if (i >= ScriptConstants.MaximumSecretBackupCount)
623624
{
624625
await Task.Delay(500);
625626
}
627+
628+
functionSecrets = await secretManager.GetFunctionSecretsAsync(functionName);
626629
}
627630
}
628631
catch (InvalidOperationException ex)

0 commit comments

Comments
 (0)