mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix a ton of server test bugs and rework code to work with the new fileserver
This commit is contained in:
parent
12395dbf00
commit
1266ca63be
@ -48,8 +48,9 @@ namespace Wabbajack.Server.Test
|
||||
Size = file.Path.Size
|
||||
};
|
||||
|
||||
var file2 = new TempFile();
|
||||
await using var file2 = new TempFile();
|
||||
await DownloadDispatcher.DownloadWithPossibleUpgrade(archive, file2.Path);
|
||||
Assert.Equal(dataHash!.Value, await file2.Path.FileHashAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -29,7 +29,7 @@ namespace Wabbajack.BuildServer.Test
|
||||
var modlist = await MakeModList("CanLoadMetadataFromTestServer.txt");
|
||||
Consts.ModlistMetadataURL = modlist.ToString();
|
||||
var data = await ModlistMetadata.LoadFromGithub();
|
||||
Assert.Equal(2, data.Count);
|
||||
Assert.Equal(3, data.Count);
|
||||
Assert.Equal("test_list", data.First().Links.MachineURL);
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,12 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
_logger.Log(LogLevel.Information, $"Creating File upload {definition.OriginalFileName}");
|
||||
|
||||
definition = await _sql.CreateAuthoredFile(definition, user);
|
||||
|
||||
using (var client = await GetBunnyCdnFtpClient())
|
||||
{
|
||||
await client.CreateDirectoryAsync($"{definition.MungedName}");
|
||||
await client.CreateDirectoryAsync($"{definition.MungedName}/parts");
|
||||
}
|
||||
|
||||
await _discord.Send(Channel.Ham,
|
||||
new DiscordMessage() {Content = $"{user} has started uploading {definition.OriginalFileName} ({definition.Size.ToFileSizeString()})"});
|
||||
@ -123,7 +129,14 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
private async Task UploadAsync(Stream stream, string path)
|
||||
{
|
||||
using var client = await GetBunnyCdnFtpClient();
|
||||
await client.UploadAsync(stream, path);
|
||||
try
|
||||
{
|
||||
await client.UploadAsync(stream, path);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
|
@ -86,7 +86,7 @@ namespace Wabbajack.Server.Services
|
||||
await definition.Parts.PMap(queue, async part =>
|
||||
{
|
||||
_logger.LogInformation($"Uploading mirror part ({part.Index}/{definition.Parts.Length})");
|
||||
var name = MakePath(part.Index);
|
||||
|
||||
var buffer = new byte[part.Size];
|
||||
await using (var fs = await path.OpenShared())
|
||||
{
|
||||
@ -95,7 +95,9 @@ namespace Wabbajack.Server.Services
|
||||
}
|
||||
|
||||
using var client = await GetClient(creds);
|
||||
var name = MakePath(part.Index);
|
||||
await client.UploadAsync(new MemoryStream(buffer), name);
|
||||
|
||||
});
|
||||
|
||||
using (var client = await GetClient(creds))
|
||||
@ -108,7 +110,8 @@ namespace Wabbajack.Server.Services
|
||||
}
|
||||
|
||||
ms.Position = 0;
|
||||
await client.UploadAsync(ms, $"{definition.Hash.ToHex()}/definition.json.gz");
|
||||
var remoteName = $"{definition.Hash.ToHex()}/definition.json.gz";
|
||||
await client.UploadAsync(ms, remoteName);
|
||||
}
|
||||
|
||||
await toUpload.Finish(_sql);
|
||||
|
@ -125,7 +125,7 @@ namespace Wabbajack.Server.Services
|
||||
|
||||
private static string PatchName(Hash oldHash, Hash newHash)
|
||||
{
|
||||
return $"\\{oldHash.ToHex()}_{newHash.ToHex()}";
|
||||
return $"{oldHash.ToHex()}_{newHash.ToHex()}";
|
||||
}
|
||||
|
||||
private async Task CleanupOldPatches()
|
||||
|
Loading…
Reference in New Issue
Block a user