Skip to content

Commit e0c48f7

Browse files
committed
Refactoring: resource_attr test.
1 parent 4d49d0c commit e0c48f7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tests/test_otel.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,17 +281,15 @@ def test_batch_size(self, http_ver, batches, idx, value, otel_mode):
281281
assert len(batches[idx][0].scope_spans[0].spans) == value
282282

283283
@pytest.mark.parametrize("idx", [0, 1, 2], ids=["batch"] * 3)
284-
def test_service_name(self, http_ver, batches, idx, otel_mode):
285-
assert (
286-
span_attr(batches[idx][0].resource, "service.name", "string_value")
287-
== f"test_http{http_ver}"
288-
)
289-
290-
@pytest.mark.parametrize("idx", [0, 1, 2], ids=["batch"] * 3)
291-
def test_resouce_attr(self, http_ver, batches, idx, otel_mode):
284+
@pytest.mark.parametrize(
285+
("name", "value"),
286+
[("service.name", "test_http"), ("my.name", "my test_http")],
287+
ids=["service.name", "my.name"],
288+
)
289+
def test_resouce_attr(self, http_ver, batches, idx, otel_mode, name, value):
292290
assert (
293-
span_attr(batches[idx][0].resource, "my.name", "string_value")
294-
== f"my test_http{http_ver}"
291+
span_attr(batches[idx][0].resource, name, "string_value")
292+
== f"{value}{http_ver}"
295293
)
296294

297295
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)