From 6ac9acfed1bc772553efb6af6822db7a549b4974 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 14 Mar 2024 10:23:03 +0400 Subject: [PATCH] Make test_otel more robust to elastic-transport changes (#2470) --- test_elasticsearch/test_server/test_otel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test_elasticsearch/test_server/test_otel.py b/test_elasticsearch/test_server/test_otel.py index 0ae7f87211..cb420c06ff 100644 --- a/test_elasticsearch/test_server/test_otel.py +++ b/test_elasticsearch/test_server/test_otel.py @@ -44,8 +44,12 @@ def test_otel_end_to_end(monkeypatch, elasticsearch_url: str): spans = memory_exporter.get_finished_spans() assert len(spans) == 1 assert spans[0].name == "search" - assert spans[0].attributes == { + expected_attributes = { "http.request.method": "POST", "db.system": "elasticsearch", + "db.operation": "search", "db.elasticsearch.path_parts.index": "logs-*", } + # Assert expected atttributes are here, but allow other attributes too + # to make this test robust to elastic-transport changes + assert expected_attributes.items() <= spans[0].attributes.items()