mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Tests for lists/status/{list}.json
This commit is contained in:
parent
9dba806e62
commit
f23f2f48c2
@ -4,6 +4,8 @@ using System.Reactive.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
using Wabbajack.BuildServer.Models.JobQueue;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.Http;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
@ -147,6 +149,19 @@ namespace Wabbajack.BuildServer.Test
|
||||
return "http://localhost:8080/" + path;
|
||||
}
|
||||
|
||||
protected async Task ClearJobQueue()
|
||||
{
|
||||
var sql = Fixture.GetService<SqlService>();
|
||||
while (true)
|
||||
{
|
||||
var job = await sql.GetJob();
|
||||
if (job == null) break;
|
||||
|
||||
job.Result = JobResult.Success();
|
||||
await sql.FinishJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Queue.Dispose();
|
||||
|
@ -21,10 +21,13 @@ namespace Wabbajack.BuildServer.Test
|
||||
[Fact, Priority(1)]
|
||||
public async Task CanIngestExportedInis()
|
||||
{
|
||||
var sql = Fixture.GetService<SqlService>();
|
||||
var to = Fixture.ServerTempFolder.Combine("IniIngest");
|
||||
await @"sql\DownloadStates".RelativeTo(AbsolutePath.EntryPoint).CopyDirectoryToAsync(to);
|
||||
var result = await _authedClient.GetStringAsync(MakeURL("indexed_files/ingest/IniIngest"));
|
||||
Assert.Equal("5", result);
|
||||
|
||||
await ClearJobQueue();
|
||||
}
|
||||
|
||||
[Fact, Priority(2)]
|
||||
|
@ -6,6 +6,7 @@ using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.BuildServer.Model.Models;
|
||||
using Wabbajack.BuildServer.Models;
|
||||
using Wabbajack.BuildServer.Models.JobQueue;
|
||||
using Wabbajack.BuildServer.Models.Jobs;
|
||||
using Wabbajack.Common;
|
||||
@ -60,9 +61,20 @@ namespace Wabbajack.BuildServer.Test
|
||||
Assert.Single(data);
|
||||
Assert.Equal(0, data.First().ValidationSummary.Failed);
|
||||
Assert.Equal(1, data.First().ValidationSummary.Passed);
|
||||
|
||||
await CheckListFeeds(0, 1);
|
||||
|
||||
}
|
||||
|
||||
private async Task CheckListFeeds(int failed, int passed)
|
||||
{
|
||||
var statusJson = await _client.GetJsonAsync<DetailedStatus>(MakeURL("lists/status/test_list.json"));
|
||||
Assert.Equal(failed, statusJson.Archives.Count(a => a.IsFailing));
|
||||
Assert.Equal(passed, statusJson.Archives.Count(a => !a.IsFailing));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private async Task<Uri> MakeModList()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user