mirror of
https://github.com/ppy/osu
synced 2025-01-11 00:29:30 +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;
|
Live<BeatmapSetInfo>? imported;
|
||||||
|
|
||||||
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
using (var reader = new ZipArchiveReader(TestResources.GetTestBeatmapStream()))
|
||||||
|
{
|
||||||
imported = await importer.Import(reader);
|
imported = await importer.Import(reader);
|
||||||
|
EnsureLoaded(realm.Realm);
|
||||||
|
}
|
||||||
|
|
||||||
Assert.AreEqual(1, realm.Realm.All<BeatmapSetInfo>().Count());
|
Assert.AreEqual(1, realm.Realm.All<BeatmapSetInfo>().Count());
|
||||||
|
|
||||||
@ -510,6 +513,8 @@ namespace osu.Game.Tests.Database
|
|||||||
new ImportTask(zipStream, string.Empty)
|
new ImportTask(zipStream, string.Empty)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
realm.Run(r => r.Refresh());
|
||||||
|
|
||||||
checkBeatmapSetCount(realm.Realm, 0);
|
checkBeatmapSetCount(realm.Realm, 0);
|
||||||
checkBeatmapCount(realm.Realm, 0);
|
checkBeatmapCount(realm.Realm, 0);
|
||||||
|
|
||||||
@ -565,6 +570,8 @@ namespace osu.Game.Tests.Database
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EnsureLoaded(realm.Realm);
|
||||||
|
|
||||||
checkBeatmapSetCount(realm.Realm, 1);
|
checkBeatmapSetCount(realm.Realm, 1);
|
||||||
checkBeatmapCount(realm.Realm, 12);
|
checkBeatmapCount(realm.Realm, 12);
|
||||||
|
|
||||||
@ -726,6 +733,8 @@ namespace osu.Game.Tests.Database
|
|||||||
|
|
||||||
var imported = importer.Import(toImport);
|
var imported = importer.Import(toImport);
|
||||||
|
|
||||||
|
realm.Run(r => r.Refresh());
|
||||||
|
|
||||||
Assert.NotNull(imported);
|
Assert.NotNull(imported);
|
||||||
Debug.Assert(imported != null);
|
Debug.Assert(imported != null);
|
||||||
|
|
||||||
@ -891,6 +900,8 @@ namespace osu.Game.Tests.Database
|
|||||||
string? temp = TestResources.GetTestBeatmapForImport();
|
string? temp = TestResources.GetTestBeatmapForImport();
|
||||||
await importer.Import(temp);
|
await importer.Import(temp);
|
||||||
|
|
||||||
|
EnsureLoaded(realm.Realm);
|
||||||
|
|
||||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||||
BeatmapSetInfo setToUpdate = realm.Realm.All<BeatmapSetInfo>().First();
|
BeatmapSetInfo setToUpdate = realm.Realm.All<BeatmapSetInfo>().First();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user