mirror of
https://github.com/ppy/osu
synced 2025-01-10 16:19:47 +00:00
Merge pull request #17425 from peppy/fix-realm-import-test-assert-failure
Fix realm potentially not being refreshed in time for test asserts in `BeatmapImporterTests`
This commit is contained in:
commit
959f200638
@ -147,7 +147,10 @@ namespace osu.Game.Tests.Database
|
||||
Live<BeatmapSetInfo>? imported;
|
||||
|
||||
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
||||
{
|
||||
imported = await importer.Import(reader);
|
||||
EnsureLoaded(realm.Realm);
|
||||
}
|
||||
|
||||
Assert.AreEqual(1, realm.Realm.All<BeatmapSetInfo>().Count());
|
||||
|
||||
@ -510,6 +513,8 @@ namespace osu.Game.Tests.Database
|
||||
new ImportTask(zipStream, string.Empty)
|
||||
);
|
||||
|
||||
realm.Run(r => r.Refresh());
|
||||
|
||||
checkBeatmapSetCount(realm.Realm, 0);
|
||||
checkBeatmapCount(realm.Realm, 0);
|
||||
|
||||
@ -565,6 +570,8 @@ namespace osu.Game.Tests.Database
|
||||
{
|
||||
}
|
||||
|
||||
EnsureLoaded(realm.Realm);
|
||||
|
||||
checkBeatmapSetCount(realm.Realm, 1);
|
||||
checkBeatmapCount(realm.Realm, 12);
|
||||
|
||||
@ -726,6 +733,8 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
var imported = importer.Import(toImport);
|
||||
|
||||
realm.Run(r => r.Refresh());
|
||||
|
||||
Assert.NotNull(imported);
|
||||
Debug.Assert(imported != null);
|
||||
|
||||
@ -891,6 +900,8 @@ namespace osu.Game.Tests.Database
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
await importer.Import(temp);
|
||||
|
||||
EnsureLoaded(realm.Realm);
|
||||
|
||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||
BeatmapSetInfo setToUpdate = realm.Realm.All<BeatmapSetInfo>().First();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user