Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flobernd committed Nov 21, 2024
1 parent eaffb81 commit ba6675f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/Tests.Core/Client/FixedResponseClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static ElasticsearchClient Create(
object response,
int statusCode = 200,
Func<ElasticsearchClientSettings, ElasticsearchClientSettings> modifySettings = null,
string contentType = RequestData.DefaultContentType,
string contentType = BoundConfiguration.DefaultContentType,
Exception exception = null
)
{
Expand All @@ -29,7 +29,7 @@ public static ElasticsearchClientSettings CreateConnectionSettings(
object response,
int statusCode = 200,
Func<ElasticsearchClientSettings, ElasticsearchClientSettings> modifySettings = null,
string contentType = RequestData.DefaultContentType,
string contentType = BoundConfiguration.DefaultContentType,
Exception exception = null,
Serializer serializer = null
)
Expand All @@ -46,7 +46,7 @@ public static ElasticsearchClientSettings CreateConnectionSettings(
break;
default:
{
responseBytes = contentType == RequestData.DefaultContentType
responseBytes = contentType == BoundConfiguration.DefaultContentType
? serializer.SerializeToBytes(response,
TestClient.Default.ElasticsearchClientSettings.MemoryStreamFactory)
: Encoding.UTF8.GetBytes(response.ToString());
Expand Down
10 changes: 5 additions & 5 deletions tests/Tests/ClientConcepts/OpenTelemetry/OpenTelemetryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,24 @@ public async Task BasicOpenTelemetryTest()

client.Ping();

VerifyActivity(oTelActivity, "ping");
VerifyActivity(oTelActivity, "ping", "HEAD");

await client.PingAsync();

VerifyActivity(oTelActivity, "ping");
VerifyActivity(oTelActivity, "ping", "HEAD");

await client.SearchAsync<Project>(s => s.Index("test").Query(q => q.MatchAll(m => { })));

VerifyActivity(oTelActivity, "search", "http://localhost:9200/test/_search?pretty=true&error_trace=true");
VerifyActivity(oTelActivity, "search", "GET", "http://localhost:9200/test/_search?pretty=true&error_trace=true");

static void VerifyActivity(Activity oTelActivity, string operation, string url = null)
static void VerifyActivity(Activity oTelActivity, string operation, string displayName, string url = null)
{
oTelActivity.Should().NotBeNull();

oTelActivity.Kind.Should().Be(ActivityKind.Client);

oTelActivity.DisplayName.Should().Be(operation);
oTelActivity.OperationName.Should().Be(operation);
oTelActivity.DisplayName.Should().Be(displayName);

oTelActivity.Tags.Should().Contain(n => n.Key == "elastic.transport.product.name" && n.Value == "elasticsearch-net");
oTelActivity.Tags.Should().Contain(n => n.Key == "db.system" && n.Value == "elasticsearch");
Expand Down

0 comments on commit ba6675f

Please sign in to comment.