test(upserver): 归档存档迁移与玩法闭环回归工具

This commit is contained in:
Liubing\LB
2026-09-28 18:16:14 +08:00
parent c4ae02def9
commit a6f5e107f8
232 changed files with 12903 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using asap.core;
using System;
using System.Threading.Tasks;
using game.Account;
var liveApi = GContext.container.Resolve<ICustomServerMgr>();
var liveUser = GContext.container.Resolve<game.IUserService>();
if (liveApi.ApiBaseUri.AbsoluteUri != "http://s101.local:18080/" || liveUser.ApiPlayerId != "101") return "Refused: baseline changed";
var endpoint = new Uri("http://127.0.0.1:62848/");
using var session = new S101AccountSession(endpoint);
var output = new System.Text.StringBuilder();
foreach (var mode in new [] { "reset" })
{
var start = DateTime.UtcNow;
var failed = await session.LoginAsync("102");
var elapsed = (DateTime.UtcNow - start).TotalSeconds;
var expected = mode == "401" ? AccountLoginError.Http : mode == "reset" ? AccountLoginError.Network : AccountLoginError.Timeout;
if (failed.Error != expected || session.IsAuthenticated || session.InternalId != 0 || session.PlayerId != null)
throw new Exception("Failure isolation mismatch: " + mode + "/" + failed.Error);
if (mode == "401" && failed.StatusCode != 401) throw new Exception("Missing real 401");
if (mode == "timeout" && elapsed < 14) throw new Exception("Timeout was not real production duration");
var retried = await session.LoginAsync("102");
if (!retried.Success || !session.IsAuthenticated || session.PlayerId != "102") throw new Exception("Recovery failed: " + retried.Error);
var read = await session.CheckAuthorizationAsync();
if (!read.Success) throw new Exception("Server rejected recovered Cookie: " + read.Error);
output.AppendLine(mode + ": " + failed.Error + "; seconds=" + elapsed.ToString("F1") + "; Retry=OK; AuthorizedRead=OK");
}
return output.ToString() + "Live101Unchanged=" + (liveUser.IsAuthorized && liveUser.ApiPlayerId == "101" && liveApi.ApiBaseUri.AbsoluteUri == "http://s101.local:18080/");