mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Remove obsoleted tournament migration flow
This commit is contained in:
@ -49,7 +49,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
// manual cleaning so we can prepare a config file.
|
||||
storage.DeleteDirectory(string.Empty);
|
||||
|
||||
using (var storageConfig = new TournamentStorageManager(storage))
|
||||
using (var storageConfig = new TournamentConfigManager(storage))
|
||||
storageConfig.SetValue(StorageConfig.CurrentTournament, custom_tournament);
|
||||
|
||||
try
|
||||
@ -66,82 +66,5 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMigration()
|
||||
{
|
||||
using (HeadlessGameHost host = new TestRunHeadlessGameHost(nameof(TestMigration), null)) // don't use clean run as we are writing test files for migration.
|
||||
{
|
||||
string osuRoot = Path.Combine(host.UserStoragePaths.First(), nameof(TestMigration));
|
||||
string configFile = Path.Combine(osuRoot, "tournament.ini");
|
||||
|
||||
if (File.Exists(configFile))
|
||||
File.Delete(configFile);
|
||||
|
||||
// Recreate the old setup that uses "tournament" as the base path.
|
||||
string oldPath = Path.Combine(osuRoot, "tournament");
|
||||
|
||||
string videosPath = Path.Combine(oldPath, "Videos");
|
||||
string modsPath = Path.Combine(oldPath, "Mods");
|
||||
string flagsPath = Path.Combine(oldPath, "Flags");
|
||||
|
||||
Directory.CreateDirectory(videosPath);
|
||||
Directory.CreateDirectory(modsPath);
|
||||
Directory.CreateDirectory(flagsPath);
|
||||
|
||||
// Define testing files corresponding to the specific file migrations that are needed
|
||||
string bracketFile = Path.Combine(osuRoot, TournamentGameBase.BRACKET_FILENAME);
|
||||
|
||||
string drawingsConfig = Path.Combine(osuRoot, "drawings.ini");
|
||||
string drawingsFile = Path.Combine(osuRoot, "drawings.txt");
|
||||
string drawingsResult = Path.Combine(osuRoot, "drawings_results.txt");
|
||||
|
||||
// Define sample files to test recursive copying
|
||||
string videoFile = Path.Combine(videosPath, "video.mp4");
|
||||
string modFile = Path.Combine(modsPath, "mod.png");
|
||||
string flagFile = Path.Combine(flagsPath, "flag.png");
|
||||
|
||||
File.WriteAllText(bracketFile, "{}");
|
||||
File.WriteAllText(drawingsConfig, "test");
|
||||
File.WriteAllText(drawingsFile, "test");
|
||||
File.WriteAllText(drawingsResult, "test");
|
||||
File.WriteAllText(videoFile, "test");
|
||||
File.WriteAllText(modFile, "test");
|
||||
File.WriteAllText(flagFile, "test");
|
||||
|
||||
try
|
||||
{
|
||||
var osu = LoadTournament(host);
|
||||
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
string migratedPath = Path.Combine(host.Storage.GetFullPath("."), "tournaments", "default");
|
||||
|
||||
videosPath = Path.Combine(migratedPath, "Videos");
|
||||
modsPath = Path.Combine(migratedPath, "Mods");
|
||||
flagsPath = Path.Combine(migratedPath, "Flags");
|
||||
|
||||
videoFile = Path.Combine(videosPath, "video.mp4");
|
||||
modFile = Path.Combine(modsPath, "mod.png");
|
||||
flagFile = Path.Combine(flagsPath, "flag.png");
|
||||
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(migratedPath));
|
||||
|
||||
Assert.True(storage.Exists(TournamentGameBase.BRACKET_FILENAME));
|
||||
Assert.True(storage.Exists("drawings.txt"));
|
||||
Assert.True(storage.Exists("drawings_results.txt"));
|
||||
|
||||
Assert.True(storage.Exists("drawings.ini"));
|
||||
|
||||
Assert.True(storage.Exists(videoFile));
|
||||
Assert.True(storage.Exists(modFile));
|
||||
Assert.True(storage.Exists(flagFile));
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user