This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc.Testing; | |
namespace App.API.Tests.Integration | |
{ | |
public class APIWebApplicationFactory : WebApplicationFactory<App.API.Startup> | |
{ | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<TargetFramework>netcoreapp2.2</TargetFramework> | |
<IsPackable>false</IsPackable> | |
</PropertyGroup> | |
<ItemGroup> | |
<PackageReference Include="Microsoft.AspNetCore.App" /> | |
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" /> | |
<PackageReference Include="nunit" Version="3.11.0" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Text; | |
using System.Threading.Tasks; | |
using NUnit.Framework; | |
namespace App.API.Tests.Integration | |
{ | |
[TestFixture] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainOrchestrator | |
{ | |
[FunctionName(nameof(MainOrchestrator))] | |
public static async Task<bool> RunOrchestrator( | |
[OrchestrationTrigger] DurableOrchestrationContextBase context, | |
ILogger logger) | |
{ | |
var subTasks = new List<Task>(); | |
for(var i = 0; i < 10000; i++) | |
subTasks.Add(context.CallSubOrchestratorAsync<ReturnObject>(nameof(SubOrchestrator), i)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("start/{runId:guid}")] | |
[HttpPost] | |
public async Task<IActionResult> Start(Guid runId, [FromQuery] bool returnReport) | |
{ | |
if (ValidateQueryParameters(runId, out var badRequest)) return badRequest; | |
var runSettings = await _fileService.CreateRunFolders(runId, Request.Body); | |
if (returnReport) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Route("startasync/{runId:guid}")] | |
[HttpPost] | |
public async Task<IActionResult> StartAsync(Guid runId) | |
{ | |
if (ValidateQueryParameters(runId, out var badRequest)) return badRequest; | |
var runSettings = await _fileService.CreateRunFolders(runId, Request.Body); | |
_queue.QueueBackgroundWorkItem(runId.ToString(), async token => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FileService | |
{ | |
public async Task<RunSettings> CreateRunFolders(Guid runId, Stream requestStream) | |
{ | |
var gatlingHomeFolder = Environment.GetEnvironmentVariable("GATLING_HOME"); | |
using (var memoryStream = new MemoryStream()) | |
{ | |
await requestStream.CopyToAsync(memoryStream); | |
await System.IO.File.WriteAllBytesAsync($"/tmp/{runId}.zip", memoryStream.ToArray()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GatlingService | |
{ | |
public async Task<RunResults> RunSimulation(RunSettings runSettings) | |
{ | |
var runId = runSettings.RunId; | |
var gatlingStartInfo = new ProcessStartInfo(runSettings.GatlingPath) | |
{ | |
UseShellExecute = false, | |
RedirectStandardOutput = true, | |
RedirectStandardError = true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IJobStatusService | |
{ | |
void SetState(string jobId, State newState); | |
State GetState(string jobId); | |
} | |
public class JobStatusService : IJobStatusService | |
{ | |
private readonly ConcurrentDictionary<string, State> _jobStatus = new ConcurrentDictionary<string, State>(); |
OlderNewer