Skip to content

Commit f5d9001

Browse files
committed
Wait for stopped instances
1 parent 59b9dae commit f5d9001

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/Aspire.Hosting.Oracle.Tests/OracleFunctionalTests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
145145
// Seed database
146146
dbContext.Cars.Add(new TestDbContext.Car { Brand = "BatMobile" });
147147
await dbContext.SaveChangesAsync(cts.Token);
148+
149+
await app.StopAsync();
150+
151+
// Wait for the database to not be available before attempting to clean the volume.
152+
153+
await pipeline.ExecuteAsync(async token =>
154+
{
155+
return !await dbContext.Database.CanConnectAsync(token);
156+
}, cts.Token);
148157
}
149158
}
150159
finally
@@ -193,6 +202,15 @@ public async Task WithDataShouldPersistStateBetweenUsages(bool useVolume)
193202

194203
var brands = await dbContext.Cars.ToListAsync(cancellationToken: cts.Token);
195204
Assert.Single(brands);
205+
206+
await app.StopAsync();
207+
208+
// Wait for the database to not be available before attempting to clean the volume.
209+
210+
await pipeline.ExecuteAsync(async token =>
211+
{
212+
return !await dbContext.Database.CanConnectAsync(token);
213+
}, cts.Token);
196214
}
197215
}
198216
finally

0 commit comments

Comments
 (0)