Skip to content

Commit

Permalink
Move mutect2 integration test to its own class
Browse files Browse the repository at this point in the history
  • Loading branch information
MattMcL4475 committed Jul 28, 2023
1 parent f171426 commit c880763
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
28 changes: 7 additions & 21 deletions src/TriggerService.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,6 @@ public class IntegrationTests
{
private const string testStorageAccountName = "";

/// <summary>
/// To run this test, specify a testStorageAccountName, a workflowsContainerSasToken
/// </summary>
/// <returns></returns>
[TestCategory("Integration")]
[TestMethod]
public async Task RunScaleTestWithMutect2WaitTilDoneAsync()
{
const string triggerFile = "https://raw.githubusercontent.com/microsoft/CromwellOnAzure/main/src/TriggerService.Tests/test-wdls/mutect2/mutect2.trigger.json";
const string workflowFriendlyName = $"mutect2";

await RunIntegrationTestAsync(new List<(string triggerFileBlobUrl, string workflowFriendlyName)> { (triggerFile, workflowFriendlyName) });
}

/// <summary>
/// To run this test, specify a testStorageAccountName, a workflowsContainerSasToken
/// </summary>
Expand Down Expand Up @@ -200,7 +186,7 @@ public void CountCompletedWorkflowsTest()
Assert.IsTrue(CountWorkflowsByState(originalBlobNames, currentBlobNames, WorkflowState.Succeeded) == 1);
}

private async Task RunIntegrationTestAsync(List<(string triggerFileBlobUrl, string workflowFriendlyName)> triggerFiles)
public static async Task RunIntegrationTestAsync(List<(string triggerFileBlobUrl, string workflowFriendlyName)> triggerFiles)
{
// This is set in the Azure Devops pipeline, which writes the file to the .csproj directory
// The current working directory is this: /mnt/vss/_work/r1/a/CoaArtifacts/AllSource/TriggerService.Tests/bin/Debug/net7.0/
Expand Down Expand Up @@ -229,7 +215,7 @@ private async Task RunIntegrationTestAsync(List<(string triggerFileBlobUrl, stri
await StartWorkflowsAsync(countOfWorkflowsToRun, triggerFiles, storageAccountName, waitTilDone: true, workflowsContainerSasToken);
}

private async Task StartWorkflowsAsync(
public static async Task StartWorkflowsAsync(
int countOfWorkflowsToRun,
List<(string triggerFileBlobUrl, string workflowFriendlyName)> triggerFiles,
string storageAccountName,
Expand Down Expand Up @@ -271,7 +257,7 @@ private async Task StartWorkflowsAsync(
// 2. Start the workflows by uploading new trigger files

var date = $"{startTime.Year}-{startTime.Month}-{startTime.Day}-{startTime.Hour}-{startTime.Minute}";
Console.WriteLine($"Starting {countOfWorkflowsToRun} workflows...");
Console.WriteLine($"Starting ({countOfWorkflowsToRun}) [{triggerFile.workflowFriendlyName}] workflows...");

for (var i = 1; i <= countOfWorkflowsToRun; i++)
{
Expand All @@ -289,7 +275,7 @@ private async Task StartWorkflowsAsync(
}
}

private async Task<List<string>> ListContainerBlobNamesAsync(BlobContainerClient container)
public static async Task<List<string>> ListContainerBlobNamesAsync(BlobContainerClient container)
{
var enumerator = container.GetBlobsAsync().GetAsyncEnumerator();
var existingBlobNames = new List<string>();
Expand All @@ -304,12 +290,12 @@ private async Task<List<string>> ListContainerBlobNamesAsync(BlobContainerClient
return existingBlobNames;
}

private int CountWorkflowsByState(List<string> originalBlobNames, List<string> currentBlobNames, WorkflowState state)
public static int CountWorkflowsByState(List<string> originalBlobNames, List<string> currentBlobNames, WorkflowState state)
{
return GetWorkflowsByState(originalBlobNames, currentBlobNames, state).Count();
}

private List<string> GetWorkflowsByState(List<string> originalBlobNames, List<string> currentBlobNames, WorkflowState state)
public static List<string> GetWorkflowsByState(List<string> originalBlobNames, List<string> currentBlobNames, WorkflowState state)
{
var stateString = state.ToString().ToLowerInvariant();

Expand Down Expand Up @@ -343,7 +329,7 @@ public void GetWorkflowsByStateTest()



private async Task WaitTilAllWorkflowsInTerminalStateAsync(int countOfWorkflowsToRun, DateTime startTime, BlobContainerClient container, List<string> originalBlobNames)
public static async Task WaitTilAllWorkflowsInTerminalStateAsync(int countOfWorkflowsToRun, DateTime startTime, BlobContainerClient container, List<string> originalBlobNames)
{
int succeededCount = 0;
int failedCount = 0;
Expand Down
19 changes: 19 additions & 0 deletions src/TriggerService.Tests/Mutect2IntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace TriggerService.Tests
{
internal class Mutect2IntegrationTest
{
[TestCategory("Integration")]
[TestMethod]
public async Task RunScaleTestWithMutect2WaitTilDoneAsync()
{
const string triggerFile = "https://raw.githubusercontent.com/microsoft/CromwellOnAzure/main/src/TriggerService.Tests/test-wdls/mutect2/mutect2.trigger.json";
const string workflowFriendlyName = $"mutect2";

await IntegrationTests.RunIntegrationTestAsync(new List<(string triggerFileBlobUrl, string workflowFriendlyName)> { (triggerFile, workflowFriendlyName) });
}
}
}

0 comments on commit c880763

Please sign in to comment.