Skip to content

Commit 0fd432e

Browse files
committed
Sets completion dates
1 parent 6543363 commit 0fd432e

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

ReleaseNotes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 0.4.5
22

33
- [Fix] Fix for API version when patching a test run as completed
4+
- [Feature] Sets completion dates
45

56
# 0.4.4
67

src/AzurePipelines.TestLogger/LoggerQueue.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ private async Task SendTestResults(IEnumerable<IGrouping<string, ITestResult>> t
227227
parent.Duration += Convert.ToInt64(x.Sum(t => t.Duration.TotalMilliseconds));
228228
return $@"{{
229229
""id"": { parent.Id },
230-
""durationInMs"": { parent.Duration },
230+
""durationInMs"": { parent.Duration.ToString(CultureInfo.InvariantCulture) },
231+
""completedDate"": ""{ DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") }"",
231232
{ failedOutcome }
232233
""subResults"": { subResults }
233234
}}";
@@ -288,13 +289,15 @@ private async Task SendTestsCompleted(CancellationToken cancellationToken)
288289
string parentRequest = "[ " + string.Join(", ", Parents.Values.Select(x =>
289290
$@"{{
290291
""id"": { x.Id },
291-
""state"": ""Completed""
292+
""state"": ""Completed"",
293+
""completedDate"": ""{ DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") }""
292294
}}")) + " ]";
293295
await _apiClient.SendAsync(new HttpMethod("PATCH"), TestRunEndpoint, "5.0-preview.5", parentRequest, cancellationToken);
294296

295297
// Mark the overall test run as completed
296298
string testRunRequest = $@"{{
297-
""state"": ""Completed""
299+
""state"": ""Completed"",
300+
""completedDate"": ""{ DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") }""
298301
}}";
299302
await _apiClient.SendAsync(new HttpMethod("PATCH"), $"/{RunId}", "5.0-preview.2", testRunRequest, cancellationToken);
300303
}

0 commit comments

Comments
 (0)