Skip to content

Commit

Permalink
Sends started dates when marking as completed
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed Dec 15, 2018
1 parent 13d3954 commit a4da0d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.4.7

- [Fix] Sends start dates when marking as completed so they don't get reset

# 0.4.6

- [Feature] Sets start dates
Expand Down
5 changes: 4 additions & 1 deletion src/AzurePipelines.TestLogger/LoggerQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,21 @@ private string GetTestResultJson(ITestResult testResult)
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 =>
$@"{{
""id"": { x.Id },
""state"": ""Completed"",
""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);

// Mark the overall test run as completed
string testRunRequest = $@"{{
""state"": ""Completed"",
""startedDate"": ""{ StartedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") }"",
""completedDate"": ""{ completedDate }""
}}";
await _apiClient.SendAsync(new HttpMethod("PATCH"), $"/{RunId}", "5.0-preview.2", testRunRequest, cancellationToken);
Expand Down

0 comments on commit a4da0d8

Please sign in to comment.