From cdd7ad020e165fe680703b6d3319b908b682fb7a Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 20 Oct 2023 17:12:29 +0300 Subject: jaeger-client -> opentelemetry --- .../tests/Jaeger/Mapper/SpanToJaegerMapperTest.php | 169 --------------------- 1 file changed, 169 deletions(-) delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php (limited to 'vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php') diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php deleted file mode 100644 index d536cb63a..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php +++ /dev/null @@ -1,169 +0,0 @@ -tracer = new Tracer($this->serviceName, new NullReporter, new ConstSampler); - $this->context = new SpanContext(0, 0, 0, SAMPLED_FLAG); - } - - /** - * {@inheritdoc} - */ - protected function tearDown(): void - { - $this->tracer = null; - $this->context = null; - } - - /** @test */ - public function shouldProperlyInitializeAtConstructTime(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $span->setTags([ - "tag-bool1" => true, - "tag-bool2" => false, - "tag-int" => 1234567, - "tag-float" => 1.23456, - "tag-string" => "hello-world" - ]); - - $mapper = new SpanToJaegerMapper(); - $thriftSpan = $mapper->mapSpanToJaeger($span); - - $index = 0; - $this->assertEquals($thriftSpan->tags[$index]->key, "component"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::STRING); - $this->assertEquals($thriftSpan->tags[$index]->vStr, $this->serviceName); - $index++; - - $this->assertEquals($thriftSpan->tags[$index]->key, "tag-bool1"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::BOOL); - $this->assertEquals($thriftSpan->tags[$index]->vBool, true); - $index++; - - $this->assertEquals($thriftSpan->tags[$index]->key, "tag-bool2"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::BOOL); - $this->assertEquals($thriftSpan->tags[$index]->vBool, false); - $index++; - - $this->assertEquals($thriftSpan->tags[$index]->key, "tag-int"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::LONG); - $this->assertEquals($thriftSpan->tags[$index]->vLong, 1234567); - $index++; - - $this->assertEquals($thriftSpan->tags[$index]->key, "tag-float"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::DOUBLE); - $this->assertEquals($thriftSpan->tags[$index]->vDouble, 1.23456); - $index++; - - $this->assertEquals($thriftSpan->tags[$index]->key, "tag-string"); - $this->assertEquals($thriftSpan->tags[$index]->vType, TagType::STRING); - $this->assertEquals($thriftSpan->tags[$index]->vStr, "hello-world"); - $index++; - } - - /** - * @dataProvider specialTagProvider - * @param array $tags - * @return void - */ - public function testSpecialTagsAreAdded(array $tags): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $span->setTags($tags); - - // The component tag is always added, even if it's not specified in tags - $expectedTagValues = array_merge([COMPONENT => $this->serviceName], $tags); - - $mapper = new SpanToJaegerMapper(); - $thriftSpan = $mapper->mapSpanToJaeger($span); - - $foundTags = []; - - foreach ($thriftSpan->tags as $tag) { - $foundTags[] = $tag->key; - - switch ($tag->key) { - case PEER_SERVICE: - case PEER_HOST_IPV4: - case SPAN_KIND: - case COMPONENT: - $this->assertEquals(TagType::STRING, $tag->vType, 'Incorrect tag value type'); - $this->assertEquals($expectedTagValues[$tag->key], $tag->vStr, 'Incorrect tag value'); - break; - case PEER_PORT: - $this->assertEquals(TagType::LONG, $tag->vType, 'Incorrect tag value type'); - $this->assertEquals($expectedTagValues[$tag->key], $tag->vLong, 'Incorrect tag value'); - break; - } - } - - $this->assertEqualsCanonicalizing(array_keys($expectedTagValues), $foundTags, 'Some of the tags are missing'); - } - - public function specialTagProvider(): array - { - return [ - [ - [ - 'bool_tag' => true, - PEER_SERVICE => 'my_service', - PEER_HOST_IPV4 => '127.0.0.1', - PEER_PORT => 443, - SPAN_KIND => SPAN_KIND_RPC_CLIENT, - COMPONENT => 'grpc', - ], - ], - [ - [ - 'int_tag' => 5, - PEER_HOST_IPV4 => '192.168.0.1', - PEER_PORT => 80, - ], - ], - [ - [ - 'string_tag' => 'testing-tag', - PEER_PORT => 80, - COMPONENT => 'grpc', - ], - ], - [ - [ - 'string_tag' => 'testing-tag', - ], - ], - ]; - } -} -- cgit v1.2.3