Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 1.x] Bump Microsoft.NET.Test.Sdk and Microsoft.TestPlatform.ObjectModel #658

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bumps `CSharpier.Core` from 0.27.3 to 0.28.2
- Bumps `Spectre.Console` from 0.48.0 to 0.49.1
- Bumps `Nullean.VsTest.Pretty.TestLogger` from 0.3.0 to 0.4.0
- Bumps `Microsoft.NET.Test.Sdk` from 17.9.0 to 17.10.0
- Bumps `Microsoft.TestPlatform.ObjectModel` from 17.9.0 to 17.10.0

## [1.7.1]
### Fixed
Expand Down Expand Up @@ -171,4 +173,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
[1.6.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.5.0...v1.6.0
[1.5.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.4.0...v1.5.0
[1.4.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.3.0...v1.4.0
[1.3.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.2.0...v1.3.0
[1.3.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.2.0...v1.3.0
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion tests/Tests.Auth.AwsSigV4/Tests.Auth.AwsSigV4.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Core\Tests.Core.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" />
</ItemGroup>
</Project>
115 changes: 58 additions & 57 deletions tests/Tests.Reproduce/GitHubIssue5363.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,64 +34,65 @@
using OpenSearch.OpenSearch.Xunit.XunitPlumbing;
using OpenSearch.Net;
using OpenSearch.Net.Diagnostics;
using Tests.Core.Xunit;
using Xunit;

namespace Tests.Reproduce
namespace Tests.Reproduce;

[Skip("When run in parallel with other tests the diagnostic listener may throw null pointer exceptions")]
public class GitHubIssue5363
{
public class GitHubIssue5363
{
internal class TestDiagnosticListener : IObserver<DiagnosticListener>, IDisposable
{
private ConcurrentBag<IDisposable> Disposables { get; } = new();

public Action<IApiCallDetails> OnEnded { get; }

public TestDiagnosticListener(Action<IApiCallDetails> onEnded) => OnEnded = onEnded;

public void OnError(Exception error) { }
public void OnCompleted() { }

public void OnNext(DiagnosticListener value) =>
TrySubscribe(DiagnosticSources.RequestPipeline.SourceName,
() => new RequestPipelineDiagnosticObserver(null, v => OnEnded(v.Value)), value);

private void TrySubscribe(string sourceName, Func<IObserver<KeyValuePair<string, object>>> listener, DiagnosticListener value)
{
if (value.Name != sourceName)
return;
var d = value.Subscribe(listener());

Disposables.Add(d);
}

public void Dispose()
{
foreach (var d in Disposables)
{
d.Dispose();
}
}
}

[U]
public async Task DiagnosticListener_AuditTrailIsValid()
{
using var listener = new TestDiagnosticListener(data =>
{
var auditTrailEvent = data.AuditTrail[0];

Assert.True(auditTrailEvent.Ended != default);
});

using var foo = DiagnosticListener.AllListeners.Subscribe(listener);

var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionConfiguration(connectionPool, new InMemoryConnection());

var client = new OpenSearchLowLevelClient(settings);
var person = new { Id = "1" };

await client.IndexAsync<BytesResponse>("test-index", PostData.Serializable(person));
}
}
internal class TestDiagnosticListener : IObserver<DiagnosticListener>, IDisposable
{
private ConcurrentBag<IDisposable> Disposables { get; } = new();

public Action<IApiCallDetails> OnEnded { get; }

public TestDiagnosticListener(Action<IApiCallDetails> onEnded) => OnEnded = onEnded;

public void OnError(Exception error) { }
public void OnCompleted() { }

public void OnNext(DiagnosticListener value) =>
TrySubscribe(DiagnosticSources.RequestPipeline.SourceName,
() => new RequestPipelineDiagnosticObserver(null, v => OnEnded(v.Value)), value);

private void TrySubscribe(string sourceName, Func<IObserver<KeyValuePair<string, object>>> listener, DiagnosticListener value)
{
if (value.Name != sourceName)
return;
var d = value.Subscribe(listener());

Disposables.Add(d);
}

public void Dispose()
{
foreach (var d in Disposables)
{
d.Dispose();
}
}
}

[U]
public async Task DiagnosticListener_AuditTrailIsValid()
{
using var listener = new TestDiagnosticListener(data =>
{
var auditTrailEvent = data.AuditTrail[0];

Assert.True(auditTrailEvent.Ended != default);
});

using var foo = DiagnosticListener.AllListeners.Subscribe(listener);

var connectionPool = new SingleNodeConnectionPool(new Uri("http://localhost:9200"));
var settings = new ConnectionConfiguration(connectionPool, new InMemoryConnection());

var client = new OpenSearchLowLevelClient(settings);
var person = new { Id = "1" };

await client.IndexAsync<BytesResponse>("test-index", PostData.Serializable(person));
}
}
2 changes: 1 addition & 1 deletion tests/Tests.Reproduce/Tests.Reproduce.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Core\Tests.Core.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion tests/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionRoot)\tests\Tests.Core\Tests.Core.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="FSharp.Core" Version="8.0.300" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="SemanticVersioning" Version="2.0.2" />
Expand Down
Loading