Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add germline integration test #632

Merged
merged 3 commits into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 38 additions & 14 deletions src/TriggerService.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Net.Http;
using System.Threading.Tasks;
using Azure.Storage.Blobs;
Expand Down Expand Up @@ -26,21 +29,24 @@ public async Task RunScaleTestWithMutect2Async()
const int countOfWorkflowsToRun = 100;
const string triggerFile = "https://raw.githubusercontent.com/microsoft/gatk4-somatic-snvs-indels-azure/main-azure/mutect2.trigger.json";
const string workflowFriendlyName = $"mutect2";
const string containerName = "workflows";

var n = DateTime.UtcNow;
var date = $"{n.Year}-{n.Month}-{n.Day}-{n.Hour}-{n.Minute}";
using var httpClient = new HttpClient();
var triggerFileJson = await (await httpClient.GetAsync(triggerFile)).Content.ReadAsStringAsync();
await StartWorkflowsAsync(countOfWorkflowsToRun, triggerFile, workflowFriendlyName);
}

for (var i = 1; i <= countOfWorkflowsToRun; i++)
{
// example: new/mutect2-001-of-100-2023-4-7-3-9.0fb0858a-3166-4a22-85b6-4337df2f53c5.json
var blobName = $"new/{workflowFriendlyName}-{i:D3}-of-{countOfWorkflowsToRun:D3}-{date}.json";
var blobClient = new BlobServiceClient(new Uri($"https://{testStorageAccountName}.blob.core.windows.net/{containerName}/{blobName}?{workflowsContainerSasToken.TrimStart('?')}"));
var container = blobClient.GetBlobContainerClient(containerName);
await container.GetBlobClient(blobName).UploadAsync(BinaryData.FromString(triggerFileJson), true);
}
/// <summary>
/// To run this test, specify a testStorageAccountName, a workflowsContainerSasToken, and remove the [Ignore] attribute
/// </summary>
/// <returns></returns>
[Ignore]
[TestCategory("Integration")]
[TestMethod]
public async Task RunScaleTestWithWholeGenomeGermlineSingleSampleAsync()
{
const int countOfWorkflowsToRun = 1500;
const string triggerFile = "https://raw.githubusercontent.com/microsoft/gatk4-genome-processing-pipeline-azure/main-azure/WholeGenomeGermlineSingleSample.trigger.json";
const string workflowFriendlyName = $"wgs-germline";

await StartWorkflowsAsync(countOfWorkflowsToRun, triggerFile, workflowFriendlyName);
}

[Ignore]
Expand Down Expand Up @@ -76,5 +82,23 @@ public async Task DeleteOldBatchPoolsAsync()

Console.WriteLine($"Deleted {count} pools.");
}

private static async Task StartWorkflowsAsync(int countOfWorkflowsToRun, string triggerFile, string workflowFriendlyName)
{
const string containerName = "workflows";
var n = DateTime.UtcNow;
var date = $"{n.Year}-{n.Month}-{n.Day}-{n.Hour}-{n.Minute}";
using var httpClient = new HttpClient();
var triggerFileJson = await (await httpClient.GetAsync(triggerFile)).Content.ReadAsStringAsync();

for (var i = 1; i <= countOfWorkflowsToRun; i++)
{
// example: new/mutect2-001-of-100-2023-4-7-3-9.0fb0858a-3166-4a22-85b6-4337df2f53c5.json
var blobName = $"new/{workflowFriendlyName}-{i:D4}-of-{countOfWorkflowsToRun:D4}-{date}.json";
var blobClient = new BlobServiceClient(new Uri($"https://{testStorageAccountName}.blob.core.windows.net/{containerName}/{blobName}?{workflowsContainerSasToken.TrimStart('?')}"));
var container = blobClient.GetBlobContainerClient(containerName);
await container.GetBlobClient(blobName).UploadAsync(BinaryData.FromString(triggerFileJson), true);
}
}
}
}