Skip to content

Commit 8a00be1

Browse files
committed
Fix for when a test run didn't produce any results
1 parent 5caebef commit 8a00be1

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

ReleaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.0.1
2+
3+
- [Fix] Makes sure not to end test runs that didn't send any results
4+
15
# 1.0.0
26

37
- [Refactoring] Code quality improvements

src/AzurePipelines.TestLogger/LoggerQueue.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,18 @@ private async Task SendTestsCompleted(CancellationToken cancellationToken)
290290
{
291291
string completedDate = DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ");
292292

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

303306
// Mark the overall test run as completed
304307
string testRunRequest = $@"{{

0 commit comments

Comments
 (0)