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 abort all workflows integration test #634

Merged
merged 3 commits into from
Apr 8, 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
25 changes: 24 additions & 1 deletion src/TriggerService.Tests/IntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ public async Task RunScaleTestWithWholeGenomeGermlineSingleSampleAsync()
await StartWorkflowsAsync(countOfWorkflowsToRun, triggerFile, workflowFriendlyName);
}

/// <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 CancelAllRunningWorkflowsAsync()
{
const string containerName = "workflows";

var blobClient = new BlobServiceClient(new Uri($"https://{testStorageAccountName}.blob.core.windows.net?{workflowsContainerSasToken.TrimStart('?')}"));
var container = blobClient.GetBlobContainerClient(containerName);
var enumerator = container.GetBlobsAsync(prefix: "inprogress/").GetAsyncEnumerator();

while (await enumerator.MoveNextAsync())
{
// example: inprogress/mutect2-001-of-100-2023-4-7-3-9.0fb0858a-3166-4a22-85b6-4337df2f53c5.json
var blobName = enumerator.Current.Name;
await container.GetBlobClient($"abort/{System.IO.Path.GetFileName(blobName)}").UploadAsync(BinaryData.FromString(string.Empty), true);
}
}

[Ignore]
[TestCategory("Integration")]
[TestMethod]
Expand Down Expand Up @@ -93,7 +116,7 @@ private static async Task StartWorkflowsAsync(int countOfWorkflowsToRun, string

for (var i = 1; i <= countOfWorkflowsToRun; i++)
{
// example: new/mutect2-001-of-100-2023-4-7-3-9.0fb0858a-3166-4a22-85b6-4337df2f53c5.json
// example: new/mutect2-001-of-100-2023-4-7-3-9.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);
Expand Down