Skip to content

Commit

Permalink
Updating Azure DevOps API endpoint versions
Browse files Browse the repository at this point in the history
  • Loading branch information
daveaglick committed May 15, 2019
1 parent 3c7a073 commit 488b256
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 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.3

- [Fix] Updated Azure API endpoints to 5.0 final versions since previews are 404 now.

# 1.0.2

- [Fix] Another fix for test runs without any results
Expand Down
10 changes: 5 additions & 5 deletions src/AzurePipelines.TestLogger/LoggerQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ internal async Task<int> CreateTestRun(CancellationToken cancellationToken)
{ "startedDate", StartedDate.ToString("yyyy-MM-ddTHH:mm:ss.FFFZ") },
{ "isAutomated", true }
};
string responseString = await _apiClient.SendAsync(HttpMethod.Post, null, "5.0-preview.2", request.ToJson(), cancellationToken).ConfigureAwait(false);
string responseString = await _apiClient.SendAsync(HttpMethod.Post, null, "5.0", request.ToJson(), cancellationToken).ConfigureAwait(false);
using (StringReader reader = new StringReader(responseString))
{
JsonObject response = JsonDeserializer.Deserialize(reader) as JsonObject;
Expand Down Expand Up @@ -202,7 +202,7 @@ internal async Task CreateParents(IEnumerable<IGrouping<string, ITestResult>> te
}
return properties.ToJson();
})) + " ]";
string responseString = await _apiClient.SendAsync(HttpMethod.Post, TestRunEndpoint, "5.0-preview.5", request, cancellationToken).ConfigureAwait(false);
string responseString = await _apiClient.SendAsync(HttpMethod.Post, TestRunEndpoint, "5.0", request, cancellationToken).ConfigureAwait(false);
using (StringReader reader = new StringReader(responseString))
{
JsonObject response = JsonDeserializer.Deserialize(reader) as JsonObject;
Expand Down Expand Up @@ -236,7 +236,7 @@ private async Task SendTestResults(IEnumerable<IGrouping<string, ITestResult>> t
""subResults"": {subResults}
}}";
})) + " ]";
await _apiClient.SendAsync(new HttpMethod("PATCH"), TestRunEndpoint, "5.0-preview.5", request, cancellationToken).ConfigureAwait(false);
await _apiClient.SendAsync(new HttpMethod("PATCH"), TestRunEndpoint, "5.0", request, cancellationToken).ConfigureAwait(false);
}

private string GetTestResultJson(ITestResult testResult)
Expand Down Expand Up @@ -300,15 +300,15 @@ private async Task SendTestsCompleted(CancellationToken cancellationToken)
""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", parentRequest, cancellationToken).ConfigureAwait(false);

// 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).ConfigureAwait(false);
await _apiClient.SendAsync(new HttpMethod("PATCH"), $"/{RunId}", "5.0", testRunRequest, cancellationToken).ConfigureAwait(false);
}
}
}
Expand Down

0 comments on commit 488b256

Please sign in to comment.