mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Fix dangerous File.Copy
causing intermittent realm migration test failures
Resolves an issue I've been able to locally reproduce on windows. Basically, the `File.Copy` would begin while realm was blocking. The "restore" operation is posted to the `SynchronizationContext` to run on next update call, but in the mean time the copy would begin, causing a conflict of interest. Very dangerous. Only really noticeable on windows.
This commit is contained in:
parent
8912f07745
commit
453b77e0dc
@ -254,7 +254,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
Assert.That(File.Exists(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME)));
|
Assert.That(File.Exists(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME)));
|
||||||
|
|
||||||
Directory.CreateDirectory(customPath2);
|
Directory.CreateDirectory(customPath2);
|
||||||
File.Copy(Path.Combine(customPath, OsuGameBase.CLIENT_DATABASE_FILENAME), Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME));
|
File.WriteAllText(Path.Combine(customPath2, OsuGameBase.CLIENT_DATABASE_FILENAME), "I am a text");
|
||||||
|
|
||||||
// Fails because file already exists.
|
// Fails because file already exists.
|
||||||
Assert.Throws<ArgumentException>(() => osu.Migrate(customPath2));
|
Assert.Throws<ArgumentException>(() => osu.Migrate(customPath2));
|
||||||
|
Loading…
Reference in New Issue
Block a user