From b6cfc49b0676d7ae02ba7b3e11e80f5e5dd9de67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Oct 2017 12:41:17 +0900 Subject: [PATCH] Improve resilience of beatmap import test Fixes this happening https://ci.appveyor.com/project/peppy/osu/build/master-4694/tests --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index 35bebf2d4f..a0c8fc48a5 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -118,15 +118,19 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1)."); IEnumerable resultBeatmaps = null; + IEnumerable resultBeatmapSet = null; //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitForOrAssert(() => (resultBeatmaps = store.QueryBeatmaps(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() == 12, @"Beatmaps did not import to the database in allocated time", timeout); - var set = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526).First(); + waitForOrAssert(() => (resultBeatmapSet = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Count() == 1, + @"BeatmapSet did not import to the database in allocated time", timeout); - Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), - $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); + var set = resultBeatmapSet.First(); + + waitForOrAssert(() => set.Beatmaps.Count == resultBeatmaps.Count(), + $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count}).", timeout); foreach (BeatmapInfo b in resultBeatmaps) Assert.IsTrue(set.Beatmaps.Any(c => c.OnlineBeatmapID == b.OnlineBeatmapID));