1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:35:10 +08:00

Fix test failures due to cross-test state pollution

`TestSceneEditorTestGameplay` is not isolated from database, and one of
the tests exiting editor when seeked to 60000 milliseconds
(`TestClockTimeTransferIsOneDirectional()`) ended up changing
`EditorTimestamp` to the same value, causing
`TestSaveChangesBeforeGameplayTest()` to fail due to changing initial
state.

To fix, perform a direct deletion of imported beatmaps in realm to avert
this scenario, contrary to the soft-deletion via `BeatmapManager` done
previously.
This commit is contained in:
Bartłomiej Dach 2023-06-06 20:21:55 +02:00
parent e0e013cca1
commit 46ec250d34
No known key found for this signature in database

View File

@ -209,10 +209,14 @@ namespace osu.Game.Tests.Visual.Editing
public override void TearDownSteps()
{
base.TearDownSteps();
AddStep("delete imported", () =>
AddStep("delete imported", () => Realm.Write(r =>
{
beatmaps.Delete(importedBeatmapSet);
});
// delete from realm directly rather than via `BeatmapManager` to avoid cross-test pollution
// (`BeatmapManager.Delete()` uses soft deletion, which can lead to beatmap reuse between test cases).
r.RemoveAll<BeatmapMetadata>();
r.RemoveAll<BeatmapInfo>();
r.RemoveAll<BeatmapSetInfo>();
}));
}
}
}