Skip to content

Commit

Permalink
test: Dotty updates (#2461)
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr authored May 1, 2024
1 parent 1f95c9c commit 973492b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@
<PackageReference Include="MySql.Data" Version="8.0.15" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="MySql.Data" Version="8.0.30" Condition="'$(TargetFramework)' == 'net48'" />
<!-- MySql.Data v8.0.33 is a breaking change for the agent and requires agent version 10.11.1 or greater -->
<PackageReference Include="MySql.Data" Version="8.3.0" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="MySql.Data" Version="8.4.0" Condition="'$(TargetFramework)' == 'net481'" />

<!-- MySql.Data .NET/Core references -->
<PackageReference Include="MySql.Data" Version="6.10.7" Condition="'$(TargetFramework)' == 'net6.0'" />
<!-- MySql.Data v8.0.33 is a breaking change for the agent and requires agent version 10.11.1 or greater -->
<PackageReference Include="MySql.Data" Version="8.3.0" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="MySql.Data" Version="8.4.0" Condition="'$(TargetFramework)' == 'net8.0'" />

<!-- MongoDB.Driver .NET Framework references -->
<!-- 2.3.0 is the oldest version we support, 2.17.1 is the newest version as of October 2022 -->
Expand Down Expand Up @@ -132,11 +132,11 @@
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.0" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.9" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.9" Condition="'$(TargetFramework)' == 'net48'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.5" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.11" Condition="'$(TargetFramework)' == 'net481'" />

<!-- Elastic.Clients.Elasticsearch .NET/Core references - only actually testing oldest and newest -->
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.5" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.13.11" Condition="'$(TargetFramework)' == 'net8.0'" />

<!-- Serilog .NET framework references -->
<PackageReference Include="Serilog" Version="1.5.14" Condition="'$(TargetFramework)' == 'net462'" />
Expand Down Expand Up @@ -250,12 +250,12 @@

<ItemGroup> <!-- Versions below 4.5 did not support netstandard 2.0 -->
<PackageReference Include="NLog" Version="4.5.9" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="NLog" Version="5.2.8" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageReference Include="NLog" Version="5.3.2" Condition="'$(TargetFramework)' == 'net8.0'" />

<PackageReference Include="NLog" Version="4.3.11" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="NLog" Version="4.1.2" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="NLog" Version="4.5.11" Condition="'$(TargetFramework)' == 'net48'" />
<PackageReference Include="NLog" Version="5.2.8" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="NLog" Version="5.3.2" Condition="'$(TargetFramework)' == 'net481'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
// SPDX-License-Identifier: Apache-2.0

using System;
using System.Collections.Generic;
using System.Net;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Elastic.Clients.Elasticsearch;
using Elastic.Clients.Elasticsearch.Core.MSearch;
using Elastic.Clients.Elasticsearch.QueryDsl;
using Elastic.Transport;
using NewRelic.Agent.IntegrationTests.Shared;

Expand Down Expand Up @@ -56,7 +60,9 @@ public override void Connect()
public override void Index()
{
var record = FlightRecord.GetSample();
var response = _client.Index(record, IndexName);
#pragma warning disable CS0618 // Type or member is obsolete
var response = _client.Index(record, (IndexName)IndexName);
#pragma warning restore CS0618 // Type or member is obsolete

if (!response.IsSuccess())
{
Expand All @@ -68,8 +74,9 @@ public override void Index()
public override async Task<bool> IndexAsync()
{
var record = FlightRecord.GetSample();
var req = new IndexRequest<FlightRecord>();

var response = await _client.IndexAsync(record, IndexName);
var response = await _client.IndexAsync(record, (IndexName)IndexName);

AssertResponseIsSuccess(response);

Expand Down Expand Up @@ -119,7 +126,9 @@ public override void IndexMany()
{
var records = FlightRecord.GetSamples(3);

var response = _client.IndexMany(records, IndexName);
#pragma warning disable CS0618 // Type or member is obsolete
var response = _client.IndexMany(records, (IndexName)IndexName);
#pragma warning restore CS0618 // Type or member is obsolete

AssertResponseIsSuccess(response);
}
Expand All @@ -139,21 +148,47 @@ public override async Task<bool> IndexManyAsync()
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
public override void MultiSearch()
{
// Currently unable to figure out how to make a real multisearch work in 8.x
// This empty call is enough to make the instrumentation (wrapper) execute and generate the data
// we are looking for, but we can't assert for success.
#if NET8_0_OR_GREATER || NET481_OR_GREATER
var req = new MultiSearchRequest
{
Searches =
[
new SearchRequestItem(
new MultisearchHeader { Indices = Infer.Index<FlightRecord>() },
new MultisearchBody { From = 0, Query = new MatchAllQuery() }
)
]
};
#pragma warning disable CS0618 // obsolete usage is ok here
var response = _client.MultiSearch<FlightRecord>(req);
#pragma warning restore CS0618
#else
#pragma warning disable CS0618 // obsolete usage is ok here
var response = _client.MultiSearch<FlightRecord>();
#pragma warning restore CS0618
#endif

}

[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
public override async Task<long> MultiSearchAsync()
{
// Currently unable to figure out how to make a real multisearch work in 8.x
// This empty call is enough to make the instrumentation (wrapper) execute and generate the data
// we are looking for, but we can't assert for success.
#if NET8_0_OR_GREATER || NET481_OR_GREATER
var req = new MultiSearchRequest
{
Searches =
[
new SearchRequestItem(
new MultisearchHeader { Indices = Infer.Index<FlightRecord>() },
new MultisearchBody { From = 0, Query = new MatchAllQuery() }
)
]
};

var response = await _client.MultiSearchAsync<FlightRecord>(req);
#else
var response = await _client.MultiSearchAsync<FlightRecord>();
#endif

return response.TotalResponses;
}
Expand Down

0 comments on commit 973492b

Please sign in to comment.