Skip to content

Commit d32aa63

Browse files
committed
Another try
1 parent 3ccac75 commit d32aa63

4 files changed

Lines changed: 13 additions & 7 deletions

File tree

ReleaseNotes.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# 0.2.1
1+
# 0.2.2
2+
3+
- [Feature] Better test run names
4+
- [Fix] Common API version for all endpoints
5+
6+
# 0.2.0
27

38
- [Fix] Big refactoring to create a new test run before posting results
49

src/PipelinesTestLogger/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace PipelinesTestLogger
1111
{
1212
internal class ApiClient
1313
{
14-
private const string ApiVersion = "5.0-preview.5";
14+
private const string ApiVersion = "5.0-preview.2";
1515

1616
private static readonly HttpClient _client = new HttpClient();
1717

src/PipelinesTestLogger/LoggerQueue.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace PipelinesTestLogger
99
internal class LoggerQueue
1010
{
1111
private readonly ApiClient _apiClient;
12+
private readonly string _runName;
1213
private readonly string _buildId;
13-
private readonly string _jobName;
1414

1515
private readonly AsyncProducerConsumerCollection<string> _queue = new AsyncProducerConsumerCollection<string>();
1616
private readonly Task _consumeTask;
@@ -20,11 +20,11 @@ internal class LoggerQueue
2020
private int totalEnqueued = 0;
2121
private int totalSent = 0;
2222

23-
public LoggerQueue(ApiClient apiClient, string buildId, string jobName)
23+
public LoggerQueue(ApiClient apiClient, string buildId, string agentName, string jobName)
2424
{
2525
_apiClient = apiClient;
2626
_buildId = buildId;
27-
_jobName = jobName;
27+
_runName = $"{ jobName } on { agentName } at {DateTime.UtcNow.ToString("o")}";
2828
_consumeTask = ConsumeItemsAsync(_consumeTaskCancellationSource.Token);
2929
}
3030

@@ -104,7 +104,7 @@ private async Task<int> CreateTestRun(CancellationToken cancellationToken)
104104
{
105105
Dictionary<string, object> request = new Dictionary<string, object>
106106
{
107-
{ "name", $"{_jobName} at {DateTime.UtcNow.ToString("o")}"},
107+
{ "name", _runName },
108108
{ "build", new Dictionary<string, object> { { "id", _buildId } } },
109109
{ "isAutomated", true }
110110
};

src/PipelinesTestLogger/PipelinesTestLogger.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ public void Initialize(TestLoggerEvents events, string testRunDirectory)
3232
|| !GetRequiredVariable("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI", out string collectionUri)
3333
|| !GetRequiredVariable("SYSTEM_TEAMPROJECT", out string teamProject)
3434
|| !GetRequiredVariable("BUILD_BUILDID", out string buildId)
35+
|| !GetRequiredVariable("AGENT_NAME", out string agentName)
3536
|| !GetRequiredVariable("AGENT_JOBNAME", out string jobName))
3637
{
3738
return;
3839
}
3940

4041
ApiClient apiClient = new ApiClient(accessToken, collectionUri, teamProject);
41-
_queue = new LoggerQueue(apiClient, buildId, jobName);
42+
_queue = new LoggerQueue(apiClient, buildId, agentName, jobName);
4243

4344
// Register for the events.
4445
events.TestRunMessage += TestMessageHandler;

0 commit comments

Comments
 (0)