Fix tests

This commit is contained in:
Timothy Baldridge 2021-02-22 21:38:28 -07:00
parent 0f32321971
commit 8664c16d13
3 changed files with 7 additions and 3 deletions

View File

@ -15,6 +15,7 @@ using Wabbajack.Lib.ModListRegistry;
using Wabbajack.Server;
using Wabbajack.Server.DataLayer;
using Wabbajack.Server.DTOs;
using Wabbajack.Server.Services;
using Xunit;
using Xunit.Abstractions;
@ -166,6 +167,8 @@ namespace Wabbajack.BuildServer.Test
_client = new Wabbajack.Lib.Http.Client();
_authedClient = new Wabbajack.Lib.Http.Client();
Fixture = fixture.Deref();
var cache = Fixture.GetService<MetricsKeyCache>();
cache.AddKey(Metrics.GetMetricsKey().Result);
_authedClient.Headers.Add(("x-api-key", Fixture.APIKey));
AuthorAPI.ApiKeyOverride = Fixture.APIKey;
_queue = new WorkQueue();

View File

@ -197,6 +197,7 @@ namespace Wabbajack.Server.Services
private AsyncLock _healLock = new AsyncLock();
private async Task<(Archive, ArchiveStatus)> TryToHeal(ValidationData data, Archive archive, ModlistMetadata modList)
{
using var _ = await _healLock.WaitAsync();
var srcDownload = await _sql.GetArchiveDownload(archive.State.PrimaryKeyString, archive.Hash, archive.Size);
if (srcDownload == null || srcDownload.IsFailed == true)
{
@ -219,7 +220,7 @@ namespace Wabbajack.Server.Services
return (archive, ArchiveStatus.Updated);
}
using var _ = await _healLock.WaitAsync();
var upgradeTime = DateTime.UtcNow;
_logger.LogInformation($"Validator Finding Upgrade for {archive.Hash} {archive.State.PrimaryKeyString}");

View File

@ -82,7 +82,7 @@ namespace Wabbajack.Server
{
options.Providers.Add<BrotliCompressionProvider>();
options.Providers.Add<GzipCompressionProvider>();
options.MimeTypes = new[] {"*/*"};
options.MimeTypes = new[] {"application/json"};
});
services.AddMvc();