Skip to content

Commit

Permalink
Fix for when a test run didn't produce any results
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Jan 28, 2019
1 parent 5caebef commit 8a00be1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.0.1

- [Fix] Makes sure not to end test runs that didn't send any results

# 1.0.0

- [Refactoring] Code quality improvements
Expand Down
11 changes: 7 additions & 4 deletions src/AzurePipelines.TestLogger/LoggerQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -290,15 +290,18 @@ private async Task SendTestsCompleted(CancellationToken cancellationToken)
{
string completedDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ");

// Mark all parents as completed
string parentRequest = "[ " + string.Join(", ", Parents.Values.Select(x =>
$@"{{
// Mark all parents as completed (but only if we actually created a parent)
if (TestRunEndpoint != null)
{
string parentRequest = "[ " + string.Join(", ", Parents.Values.Select(x =>
$@"{{
""id"": {x.Id},
""state"": ""Completed"",
""startedDate"": ""{x.StartedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ")}"",
""completedDate"": ""{completedDate}""
}}")) + " ]";
await _apiClient.SendAsync(new HttpMethod("PATCH"), TestRunEndpoint, "5.0-preview.5", parentRequest, cancellationToken).ConfigureAwait(false);
await _apiClient.SendAsync(new HttpMethod("PATCH"), TestRunEndpoint, "5.0-preview.5", parentRequest, cancellationToken).ConfigureAwait(false);
}

// Mark the overall test run as completed
string testRunRequest = $@"{{
Expand Down

0 comments on commit 8a00be1

Please sign in to comment.