1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 07:22:55 +08:00

Update MultiplayerClient test output with new knowledge

This commit is contained in:
Dean Herbert 2024-08-15 16:16:48 +09:00
parent 9dc496d6a7
commit 26da2c0637
No known key found for this signature in database

View File

@ -5,14 +5,15 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Development; using osu.Framework.Development;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.Localisation;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer.Countdown; using osu.Game.Online.Multiplayer.Countdown;
@ -22,7 +23,6 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Utils; using osu.Game.Utils;
using osu.Game.Localisation;
namespace osu.Game.Online.Multiplayer namespace osu.Game.Online.Multiplayer
{ {
@ -777,26 +777,22 @@ namespace osu.Game.Online.Multiplayer
Room.Playlist[Room.Playlist.IndexOf(Room.Playlist.Single(existing => existing.ID == item.ID))] = item; Room.Playlist[Room.Playlist.IndexOf(Room.Playlist.Single(existing => existing.ID == item.ID))] = item;
int existingIndex = APIRoom.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID)); int existingIndex = APIRoom.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID));
APIRoom.Playlist.RemoveAt(existingIndex); APIRoom.Playlist.RemoveAt(existingIndex);
APIRoom.Playlist.Insert(existingIndex, createPlaylistItem(item)); APIRoom.Playlist.Insert(existingIndex, createPlaylistItem(item));
} }
catch (Exception ex) catch (Exception ex)
{ {
// Temporary code to attempt to figure out long-term failing tests. // Temporary code to attempt to figure out long-term failing tests.
bool success = true; StringBuilder exceptionText = new StringBuilder();
int indexOf = -1234;
try exceptionText.AppendLine("MultiplayerClient test failure investigation");
{ exceptionText.AppendLine($"Exception : {exceptionText}");
indexOf = APIRoom!.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID)); exceptionText.AppendLine($"Lookup : {item.ID}");
Room.Playlist[indexOf] = item; exceptionText.AppendLine($"Items in Room.Playlist : {string.Join(',', Room.Playlist.Select(i => i.ID))}");
} exceptionText.AppendLine($"Items in APIRoom.Playlist: {string.Join(',', APIRoom!.Playlist.Select(i => i.ID))}");
catch
{
success = false;
}
throw new AggregateException($"Index: {indexOf} Length: {Room.Playlist.Count} Retry success: {success} Item: {JsonConvert.SerializeObject(createPlaylistItem(item))}\n\nRoom:{JsonConvert.SerializeObject(APIRoom)}", ex); throw new AggregateException(exceptionText.ToString());
} }
ItemChanged?.Invoke(item); ItemChanged?.Invoke(item);