1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Merge pull request #12219 from peppy/fix-new-test-failures

Fix incorrect wait logic in IPC location test
This commit is contained in:
Dan Balasescu 2021-03-30 15:03:35 +09:00 committed by GitHub
commit 54656e1b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,26 +26,26 @@ namespace osu.Game.Tournament.Tests.NonVisual
string basePath = Path.Combine(RuntimeInfo.StartupDirectory, "headless", nameof(CheckIPCLocation));
// Set up a fake IPC client for the IPC Storage to switch to.
string testCeDir = Path.Combine(basePath, "stable-ce");
Directory.CreateDirectory(testCeDir);
string testStableInstallDirectory = Path.Combine(basePath, "stable-ce");
Directory.CreateDirectory(testStableInstallDirectory);
string ipcFile = Path.Combine(testCeDir, "ipc.txt");
string ipcFile = Path.Combine(testStableInstallDirectory, "ipc.txt");
File.WriteAllText(ipcFile, string.Empty);
try
{
var osu = loadOsu(host);
TournamentStorage storage = (TournamentStorage)osu.Dependencies.Get<Storage>();
FileBasedIPC ipc = (FileBasedIPC)osu.Dependencies.Get<MatchIPCInfo>();
FileBasedIPC ipc = null;
waitForOrAssert(() => ipc != null, @"ipc could not be populated in a reasonable amount of time");
waitForOrAssert(() => (ipc = osu.Dependencies.Get<MatchIPCInfo>() as FileBasedIPC) != null, @"ipc could not be populated in a reasonable amount of time");
Assert.True(ipc.SetIPCLocation(testCeDir));
Assert.True(ipc.SetIPCLocation(testStableInstallDirectory));
Assert.True(storage.AllTournaments.Exists("stable.json"));
}
finally
{
host.Storage.DeleteDirectory(testCeDir);
host.Storage.DeleteDirectory(testStableInstallDirectory);
host.Storage.DeleteDirectory("tournaments");
host.Exit();
}