mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 02:03:22 +08:00
Fix export test still occasionally failing due to file write in progress
https://github.com/ppy/osu/actions/runs/6701591401/job/18209826074 Basically, `File.Move` may not be an atomic operation.
This commit is contained in:
parent
37ec10d4f5
commit
89444d5544
@ -214,10 +214,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
// Files starting with _ are temporary, created by CreateFileSafely call.
|
||||
AddUntilStep("wait for export file", () => filePath = LocalStorage.GetFiles("exports").SingleOrDefault(f => !Path.GetFileName(f).StartsWith("_", StringComparison.Ordinal)), () => Is.Not.Null);
|
||||
AddAssert("filesize is non-zero", () =>
|
||||
AddUntilStep("filesize is non-zero", () =>
|
||||
{
|
||||
using (var stream = LocalStorage.GetStream(filePath))
|
||||
return stream.Length;
|
||||
try
|
||||
{
|
||||
using (var stream = LocalStorage.GetStream(filePath))
|
||||
return stream.Length;
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// file move may still be in progress.
|
||||
return 0;
|
||||
}
|
||||
}, () => Is.Not.Zero);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user