From 2a92e255f7595024242e45c0050c8f3de7140b6b Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Mon, 30 Aug 2021 23:10:51 +0530 Subject: [PATCH 1/2] More consistent assertion methods --- .github/workflows/test.yml | 2 +- .../tests/test_aiopg_integration.py | 8 ++--- .../tests/test_botocore_instrumentation.py | 26 +++++++------- .../tests/test_tasks.py | 4 +-- .../tests/test_elasticsearch.py | 8 ++--- .../tests/test_falcon.py | 6 ++-- .../tests/test_fastapi_instrumentation.py | 2 +- .../tests/test_client_interceptor.py | 18 +++++----- .../tests/test_server_interceptor.py | 28 +++++++-------- .../tests/test_httpx_integration.py | 2 +- .../tests/test_mysql_integration.py | 2 +- .../tests/test_psycopg2_integration.py | 2 +- .../tests/test_pymysql_integration.py | 2 +- .../tests/test_requests_integration.py | 2 +- .../tests/test_starlette_instrumentation.py | 2 +- .../tests/test_instrumentation.py | 36 +++++++++---------- .../tests/test_urllib_integration.py | 2 +- 17 files changed, 75 insertions(+), 77 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f311db2bc3..579b65fedc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 3e1c89bcae77c34b9750a1f00608a04a97921c51 + CORE_REPO_SHA: 9957a512f6bdea4f268244c5fefc60c36282813b jobs: build: diff --git a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py index 24d2299166..155c9948a8 100644 --- a/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiopg/tests/test_aiopg_integration.py @@ -68,7 +68,7 @@ def test_instrumentor_connect(self): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.aiopg ) @@ -97,7 +97,7 @@ async def _ctx_manager_connect(): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.aiopg ) @@ -118,7 +118,7 @@ def test_instrumentor_create_pool(self): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.aiopg ) @@ -149,7 +149,7 @@ async def _ctx_manager_pool(): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.aiopg ) diff --git a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py index e77a255d13..a9d4eb2619 100644 --- a/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-botocore/tests/test_botocore_instrumentation.py @@ -132,8 +132,8 @@ def test_s3_client(self): assert spans span = spans[0] self.assertEqual(len(spans), 2) - self.assertEqual( - span.attributes, + self.assertSpanHasAttributes( + span, { "aws.operation": "ListBuckets", "aws.region": "us-west-2", @@ -150,8 +150,8 @@ def test_s3_client(self): spans = self.memory_exporter.get_finished_spans() assert spans span = spans[2] - self.assertEqual( - span.attributes, + self.assertSpanHasAttributes( + span, { "aws.operation": "ListObjects", "aws.region": "us-west-2", @@ -175,9 +175,9 @@ def test_s3_put(self): spans = self.memory_exporter.get_finished_spans() assert spans self.assertEqual(len(spans), 3) - create_bucket_attributes = spans[0].attributes - self.assertEqual( - create_bucket_attributes, + create_span = spans[0] + self.assertSpanHasAttributes( + create_span, { "aws.operation": "CreateBucket", "aws.region": "us-west-2", @@ -186,9 +186,9 @@ def test_s3_put(self): SpanAttributes.HTTP_STATUS_CODE: 200, }, ) - put_object_attributes = spans[1].attributes - self.assertEqual( - put_object_attributes, + put_span = spans[1] + self.assertSpanHasAttributes( + put_span, { "aws.operation": "PutObject", "aws.region": "us-west-2", @@ -198,9 +198,9 @@ def test_s3_put(self): }, ) self.assertTrue("params.Body" not in spans[1].attributes.keys()) - get_object_attributes = spans[2].attributes - self.assertEqual( - get_object_attributes, + get_span = spans[2] + self.assertSpanHasAttributes( + get_span, { "aws.operation": "GetObject", "aws.region": "us-west-2", diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_tasks.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_tasks.py index 17538aaf5d..6b2ee9a94c 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/tests/test_tasks.py +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_tasks.py @@ -50,7 +50,7 @@ def test_task(self): self.assertEqual(consumer.name, "run/tests.celery_test_tasks.task_add") self.assertEqual(consumer.kind, SpanKind.CONSUMER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( consumer, { "celery.action": "run", @@ -64,7 +64,7 @@ def test_task(self): producer.name, "apply_async/tests.celery_test_tasks.task_add" ) self.assertEqual(producer.kind, SpanKind.PRODUCER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( producer, { "celery.action": "apply_async", diff --git a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py index 49301a061e..3b99238c60 100644 --- a/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py +++ b/instrumentation/opentelemetry-instrumentation-elasticsearch/tests/test_elasticsearch.py @@ -77,8 +77,8 @@ def test_instrumentor(self, request_mock): span = spans_list[0] # Check version and name in span's instrumentation info - # self.check_span_instrumentation_info(span, opentelemetry.instrumentation.elasticsearch) - self.check_span_instrumentation_info( + # self.assertEqualSpanInstrumentationInfo(span, opentelemetry.instrumentation.elasticsearch) + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.elasticsearch ) @@ -289,7 +289,7 @@ def test_dsl_create(self, request_mock): "elasticsearch.url": "/test-index", "elasticsearch.method": "PUT", } - self.assert_span_has_attributes(span2, attributes) + self.assertSpanHasAttributes(span2, attributes) self.assertEqual( literal_eval(span2.attributes[SpanAttributes.DB_STATEMENT]), helpers.dsl_create_statement, @@ -315,7 +315,7 @@ def test_dsl_index(self, request_mock): "elasticsearch.url": helpers.dsl_index_url, "elasticsearch.method": "PUT", } - self.assert_span_has_attributes(span, attributes) + self.assertSpanHasAttributes(span, attributes) self.assertEqual( literal_eval(span.attributes[SpanAttributes.DB_STATEMENT]), { diff --git a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py index 079923d11a..db32d157a7 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py @@ -103,7 +103,7 @@ def _test_method(self, method): span.name, "HelloWorldResource.on_{0}".format(method.lower()) ) self.assertEqual(span.status.status_code, StatusCode.UNSET) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.HTTP_METHOD: method, @@ -128,7 +128,7 @@ def test_404(self): span = spans[0] self.assertEqual(span.name, "HTTP GET") self.assertEqual(span.status.status_code, StatusCode.ERROR) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.HTTP_METHOD: "GET", @@ -159,7 +159,7 @@ def test_500(self): span.status.description, "NameError: name 'non_existent_var' is not defined", ) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.HTTP_METHOD: "GET", diff --git a/instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py b/instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py index 20de363bde..a11ffea33a 100644 --- a/instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-fastapi/tests/test_fastapi_instrumentation.py @@ -222,7 +222,7 @@ def client_response_hook(send_span, response): response_spans = spans[:2] for span in response_spans: self.assertEqual(span.name, "name from response hook") - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, {"attr-from-response-hook": "value"} ) diff --git a/instrumentation/opentelemetry-instrumentation-grpc/tests/test_client_interceptor.py b/instrumentation/opentelemetry-instrumentation-grpc/tests/test_client_interceptor.py index 0f30464744..e0970994e6 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/tests/test_client_interceptor.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/tests/test_client_interceptor.py @@ -112,7 +112,7 @@ def test_unary_unary_future(self): self.assertIs(span.kind, trace.SpanKind.CLIENT) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) @@ -126,11 +126,11 @@ def test_unary_unary(self): self.assertIs(span.kind, trace.SpanKind.CLIENT) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.RPC_METHOD: "SimpleMethod", @@ -152,11 +152,11 @@ def test_unary_stream(self): self.assertIs(span.kind, trace.SpanKind.CLIENT) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.RPC_METHOD: "ServerStreamingMethod", @@ -178,11 +178,11 @@ def test_stream_unary(self): self.assertIs(span.kind, trace.SpanKind.CLIENT) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.RPC_METHOD: "ClientStreamingMethod", @@ -206,11 +206,11 @@ def test_stream_stream(self): self.assertIs(span.kind, trace.SpanKind.CLIENT) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.RPC_METHOD: "BidirectionalStreamingMethod", diff --git a/instrumentation/opentelemetry-instrumentation-grpc/tests/test_server_interceptor.py b/instrumentation/opentelemetry-instrumentation-grpc/tests/test_server_interceptor.py index c6151a04c3..23a6f148e1 100644 --- a/instrumentation/opentelemetry-instrumentation-grpc/tests/test_server_interceptor.py +++ b/instrumentation/opentelemetry-instrumentation-grpc/tests/test_server_interceptor.py @@ -106,12 +106,12 @@ def handler(request, context): self.assertIs(span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -187,12 +187,12 @@ def test_create_span(self): self.assertIs(span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -257,12 +257,12 @@ def SimpleMethod(self, request, context): self.assertIs(parent_span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( parent_span, opentelemetry.instrumentation.grpc ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( parent_span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -317,12 +317,12 @@ def test_create_span_streaming(self): self.assertIs(span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -386,12 +386,12 @@ def ServerStreamingMethod(self, request, context): self.assertIs(parent_span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( parent_span, opentelemetry.instrumentation.grpc ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( parent_span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -490,7 +490,7 @@ def handler(request, context): self.assertIsNone(span2.parent) # check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -562,7 +562,7 @@ def handler(request, context): self.assertIsNone(span2.parent) # check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", @@ -617,7 +617,7 @@ def handler(request, context): self.assertIs(span.kind, trace.SpanKind.SERVER) # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.grpc ) @@ -631,7 +631,7 @@ def handler(request, context): ) # Check attributes - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, { SpanAttributes.NET_PEER_IP: "[::1]", diff --git a/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py b/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py index c092c46626..1eacad500d 100644 --- a/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py +++ b/instrumentation/opentelemetry-instrumentation-httpx/tests/test_httpx_integration.py @@ -153,7 +153,7 @@ def test_basic(self): self.assertIs(span.status.status_code, trace.StatusCode.UNSET) - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.httpx ) diff --git a/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py b/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py index 6c114d969f..fc45b72b46 100644 --- a/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py +++ b/instrumentation/opentelemetry-instrumentation-mysql/tests/test_mysql_integration.py @@ -43,7 +43,7 @@ def test_instrumentor(self, mock_connect): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.mysql ) diff --git a/instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py b/instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py index 8219e2a6b5..d20cc41348 100644 --- a/instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py +++ b/instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_integration.py @@ -100,7 +100,7 @@ def test_instrumentor(self): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.psycopg2 ) diff --git a/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py b/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py index 35c9f4d32b..587ebc1b53 100644 --- a/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py +++ b/instrumentation/opentelemetry-instrumentation-pymysql/tests/test_pymysql_integration.py @@ -43,7 +43,7 @@ def test_instrumentor(self, mock_connect): span = spans_list[0] # Check version and name in span's instrumentation info - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.pymysql ) diff --git a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py index db9a5e7625..f9a539773e 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py +++ b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py @@ -109,7 +109,7 @@ def test_basic(self): self.assertIs(span.status.status_code, trace.StatusCode.UNSET) - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.requests ) diff --git a/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py b/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py index 8f9f20498c..14175f9075 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py @@ -153,7 +153,7 @@ def client_response_hook(send_span, response): response_spans = spans[:2] for span in response_spans: self.assertEqual(span.name, "name from response hook") - self.assert_span_has_attributes( + self.assertSpanHasAttributes( span, {"attr-from-response-hook": "value"} ) diff --git a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py index 25b72f1630..5ddece4395 100644 --- a/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-tornado/tests/test_instrumentation.py @@ -135,7 +135,7 @@ def _test_http_method_call(self, method): self.assertEqual(server.parent.span_id, client.context.span_id) self.assertEqual(server.context.trace_id, client.context.trace_id) self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: method, @@ -152,7 +152,7 @@ def _test_http_method_call(self, method): self.assertFalse(client.context.is_remote) self.assertIsNone(client.parent) self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url("/"), @@ -208,7 +208,7 @@ def _test_async_handler(self, url, handler_name): self.assertEqual(server.parent.span_id, client.context.span_id) self.assertEqual(server.context.trace_id, client.context.trace_id) self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: "GET", @@ -225,7 +225,7 @@ def _test_async_handler(self, url, handler_name): self.assertFalse(client.context.is_remote) self.assertIsNone(client.parent) self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url(url), @@ -244,7 +244,7 @@ def test_500(self): self.assertEqual(server.name, "BadHandler.get") self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: "GET", @@ -259,7 +259,7 @@ def test_500(self): self.assertEqual(client.name, "GET") self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url("/error"), @@ -278,7 +278,7 @@ def test_404(self): self.assertEqual(server.name, "ErrorHandler.get") self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: "GET", @@ -293,7 +293,7 @@ def test_404(self): self.assertEqual(client.name, "GET") self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url("/missing-url"), @@ -322,7 +322,7 @@ def test_dynamic_handler(self): self.assertEqual(server.parent.span_id, client.context.span_id) self.assertEqual(server.context.trace_id, client.context.trace_id) self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: "GET", @@ -339,7 +339,7 @@ def test_dynamic_handler(self): self.assertFalse(client.context.is_remote) self.assertIsNone(client.parent) self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url("/dyna"), @@ -363,7 +363,7 @@ def test_handler_on_finish(self): self.assertEqual(server.parent.span_id, client.context.span_id) self.assertEqual(server.context.trace_id, client.context.trace_id) self.assertEqual(server.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server, { SpanAttributes.HTTP_METHOD: "GET", @@ -380,7 +380,7 @@ def test_handler_on_finish(self): self.assertFalse(client.context.is_remote) self.assertIsNone(client.parent) self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url("/on_finish"), @@ -406,7 +406,7 @@ def test_excluded(path): client = spans[0] self.assertEqual(client.name, "GET") self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: self.get_url(path), @@ -425,7 +425,7 @@ def test_traced_attrs(self): self.assertEqual(len(spans), 2) server_span = spans[0] self.assertEqual(server_span.kind, SpanKind.SERVER) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( server_span, {"uri": "/pong?q=abc&b=123", "query": "q=abc&b=123"} ) self.memory_exporter.clear() @@ -468,7 +468,7 @@ def test_credential_removal(self): self.assertEqual(client.name, "GET") self.assertEqual(client.kind, SpanKind.CLIENT) - self.assert_span_has_attributes( + self.assertSpanHasAttributes( client, { SpanAttributes.HTTP_URL: "http://httpbin.org/status/200", @@ -520,15 +520,13 @@ def client_response_hook(span, response): server_span = spans[1] self.assertEqual(server_span.kind, SpanKind.SERVER) self.assertEqual(server_span.name, "name from server hook") - self.assert_span_has_attributes(server_span, {"uri": "/"}) + self.assertSpanHasAttributes(server_span, {"uri": "/"}) self.memory_exporter.clear() client_span = spans[2] self.assertEqual(client_span.kind, SpanKind.CLIENT) self.assertEqual(client_span.name, "name from client hook") - self.assert_span_has_attributes( - client_span, {"attr-from-hook": "value"} - ) + self.assertSpanHasAttributes(client_span, {"attr-from-hook": "value"}) self.memory_exporter.clear() diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py index 52795270bd..f037cc61bd 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_urllib_integration.py @@ -115,7 +115,7 @@ def test_basic(self): self.assertIs(span.status.status_code, trace.StatusCode.UNSET) - self.check_span_instrumentation_info( + self.assertEqualSpanInstrumentationInfo( span, opentelemetry.instrumentation.urllib ) From 27272e63eac915464299956fee3afda132059da3 Mon Sep 17 00:00:00 2001 From: Owais Lone Date: Tue, 31 Aug 2021 01:53:22 +0530 Subject: [PATCH 2/2] Updated core SHA --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 579b65fedc..7851e2fe5a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 9957a512f6bdea4f268244c5fefc60c36282813b + CORE_REPO_SHA: 9dc17e33bc083e38c1fd55b8ed6787caba8f54fe jobs: build: