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 8177832 commit c18a0e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/Tests/ClientConcepts/OpenTelemetry/OpenTelemetryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public async Task BasicOpenTelemetryTest()

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

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

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

Expand All @@ -53,13 +53,13 @@ static void VerifyActivity(Activity oTelActivity, string operation, string displ

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");
oTelActivity.Tags.Should().Contain(n => n.Key == "db.operation" && n.Value == operation);
oTelActivity.Tags.Should().Contain(n => n.Key == "db.operation" && n.Value == displayName);
oTelActivity.Tags.Should().Contain(n => n.Key == "db.user" && n.Value == "elastic");
oTelActivity.Tags.Should().Contain(n => n.Key == "url.full" && n.Value == (url ?? "http://localhost:9200/?pretty=true&error_trace=true"));
oTelActivity.Tags.Should().Contain(n => n.Key == "server.address" && n.Value == "localhost");
oTelActivity.Tags.Should().Contain(n => n.Key == "http.request.method" && n.Value == (operation == "ping" ? "HEAD" : "POST"));
oTelActivity.Tags.Should().Contain(n => n.Key == "http.request.method" && n.Value == (displayName == "ping" ? "HEAD" : "POST"));

switch (operation)
switch (displayName)
{
case "search":
oTelActivity.Tags.Should().Contain(n => n.Key == "db.elasticsearch.path_parts.index" && n.Value == "test");
Expand Down

0 comments on commit c18a0e4

Please sign in to comment.