Skip to content

Commit

Permalink
Add wait for healthy in cosmos tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerhardt committed Jan 11, 2025
1 parent 968fd3e commit 884b995
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public async Task VerifyCosmosResource(bool usePreview)

await app.StartAsync();

var rns = app.Services.GetRequiredService<ResourceNotificationService>();
await rns.WaitForResourceHealthyAsync(db.Resource.Name, cts.Token);

var hb = Host.CreateApplicationBuilder();
hb.Configuration[$"ConnectionStrings:{db.Resource.Name}"] = await db.Resource.ConnectionStringExpression.GetValueAsync(default);
hb.AddAzureCosmosClient(db.Resource.Name);
Expand Down Expand Up @@ -169,6 +172,9 @@ public async Task WithDataVolumeShouldPersistStateBetweenUsages(bool usePreview)
{
await app.StartAsync();

var rns = app.Services.GetRequiredService<ResourceNotificationService>();
await rns.WaitForResourceHealthyAsync(db1.Resource.Name, cts.Token);

try
{
var hb = Host.CreateApplicationBuilder();
Expand Down Expand Up @@ -214,6 +220,9 @@ await pipeline.ExecuteAsync(async token =>
{
await app.StartAsync();

var rns = app.Services.GetRequiredService<ResourceNotificationService>();
await rns.WaitForResourceHealthyAsync(db2.Resource.Name, cts.Token);

try
{
var hb = Host.CreateApplicationBuilder();
Expand Down

0 comments on commit 884b995

Please sign in to comment.