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/Codec/TextCodecTest.php | 170 ------------ .../tests/Jaeger/Codec/ZipkinCodecTest.php | 104 -------- .../jaeger-client-php/tests/Jaeger/ConfigTest.php | 257 ------------------ .../tests/Jaeger/Logger/StackLogger.php | 30 --- .../tests/Jaeger/Mapper/SpanToJaegerMapperTest.php | 169 ------------ .../Jaeger/Reporter/CompositeReporterTest.php | 52 ---- .../tests/Jaeger/Reporter/InMemoryReporterTest.php | 24 -- .../tests/Jaeger/Reporter/LoggingReporterTest.php | 31 --- .../tests/Jaeger/Reporter/NullReporterTest.php | 29 -- .../tests/Jaeger/Reporter/RemoteReporterTest.php | 46 ---- .../tests/Jaeger/Sampler/ConstSamplerTest.php | 43 --- .../Jaeger/Sampler/ProbablisticSamplerTest.php | 68 ----- .../tests/Jaeger/Sampler/RateLimitSamplerTest.php | 48 ---- .../tests/Jaeger/ScopeManagerTest.php | 49 ---- .../jaeger-client-php/tests/Jaeger/ScopeTest.php | 58 ---- .../tests/Jaeger/Sender/JaegerThriftSenderTest.php | 126 --------- .../tests/Jaeger/Sender/UdpSenderTest.php | 116 -------- .../tests/Jaeger/SpanContextTest.php | 37 --- .../jaeger-client-php/tests/Jaeger/SpanTest.php | 293 --------------------- .../tests/Jaeger/ThriftUdpTransportTest.php | 166 ------------ .../jaeger-client-php/tests/Jaeger/TracerTest.php | 262 ------------------ .../jonahgeorge/jaeger-client-php/tests/README.md | 48 ---- .../jaeger-client-php/tests/php-test.sh | 64 ----- 23 files changed, 2290 deletions(-) delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/TextCodecTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/ZipkinCodecTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ConfigTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Logger/StackLogger.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Mapper/SpanToJaegerMapperTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/CompositeReporterTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/InMemoryReporterTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/LoggingReporterTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/NullReporterTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/RemoteReporterTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ConstSamplerTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ProbablisticSamplerTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/RateLimitSamplerTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeManagerTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/JaegerThriftSenderTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/UdpSenderTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanContextTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ThriftUdpTransportTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/TracerTest.php delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/README.md delete mode 100644 vendor/jonahgeorge/jaeger-client-php/tests/php-test.sh (limited to 'vendor/jonahgeorge/jaeger-client-php/tests') diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/TextCodecTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/TextCodecTest.php deleted file mode 100644 index 79a1dd96f..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/TextCodecTest.php +++ /dev/null @@ -1,170 +0,0 @@ -textCodec = new TextCodec(); - } - - public function testCanInjectSimpleContextInCarrier(): void - { - $context = new SpanContext('trace-id', 'span-id', null, null); - $carrier = []; - - $this->textCodec->inject($context, $carrier); - - $this->assertCount(1 , $carrier); - $this->assertArrayHasKey(TRACE_ID_HEADER, $carrier); - } - - /** - * @dataProvider contextDataProvider - * @param bool $urlEncode - * @param $baggage - */ - public function testCanInjectContextBaggageInCarrier(bool $urlEncode, $baggage, $injectedBaggage): void - { - $carrier = []; - - $context = new SpanContext('trace-id', 'span-id', null, null, $baggage); - $textCodec = new TextCodec($urlEncode); - $textCodec->inject($context, $carrier); - - $this->assertCount(1 + count($baggage) , $carrier); - $this->assertArrayHasKey(TRACE_ID_HEADER, $carrier); - foreach ($injectedBaggage as $key => $value) { - $this->assertArrayHasKey(BAGGAGE_HEADER_PREFIX . $key, $carrier); - $this->assertEquals($carrier[BAGGAGE_HEADER_PREFIX . $key], $value); - } - } - - public function contextDataProvider() - { - return [ - [false, ['baggage-1' => 'baggage value'], ['baggage-1' => 'baggage value']], - [false, ['baggage-1' => 'https://testdomain.sk'], ['baggage-1' => 'https://testdomain.sk']], - [true, ['baggage-1' => 'https://testdomain.sk'], ['baggage-1' => 'https%3A%2F%2Ftestdomain.sk']], - ]; - } - - /** - * @dataProvider carrierDataProvider - * @param $urlEncode - * @param $carrier - * @param $traceId - * @param $spanId - * @param $parentId - * @param $flags - * @param $baggage - * @throws \Exception - */ - public function testSpanContextParsingFromHeader($urlEncode, $carrier, $traceId, $spanId, $parentId, $flags, $baggage): void - { - $textCodec = new TextCodec($urlEncode); - $spanContext = $textCodec->extract($carrier); - - $this->assertEquals($traceId, $spanContext->getTraceId()); - $this->assertEquals($spanId, $spanContext->getSpanId()); - $this->assertEquals($parentId, $spanContext->getParentId()); - $this->assertEquals($flags, $spanContext->getFlags()); - $this->assertCount(count($baggage), $spanContext->getBaggage() ? $spanContext->getBaggage() : []); - foreach ($baggage as $key => $value) { - $this->assertEquals($value, $spanContext->getBaggageItem($key)); - } - } - - public function carrierDataProvider(): array - { - return [ - [ - false, - [ - TRACE_ID_HEADER => '32834e4115071776:f7802330248418d:f123456789012345:1' - ], - "3639838965278119798", - "1114643325879075213", - "-1070935975401544891", - 1, - [] - ], - [ - false, - [ - TRACE_ID_HEADER => '32834e4115071776:f7802330248418d:f123456789012345:1', - BAGGAGE_HEADER_PREFIX . 'baggage-1' => 'https://testdomain.sk', - ], - "3639838965278119798", - "1114643325879075213", - "-1070935975401544891", - 1, - ['baggage-1' => 'https://testdomain.sk'] - ], - [ - true, - [ - TRACE_ID_HEADER => '32834e4115071776:f7802330248418d:f123456789012345:1', - BAGGAGE_HEADER_PREFIX . 'baggage-1' => 'https%3A%2F%2Ftestdomain.sk', - ], - "3639838965278119798", - "1114643325879075213", - "-1070935975401544891", - 1, - ['baggage-1' => 'https://testdomain.sk'] - ] - ]; - } - - public function testBaggageWithoutTraceContext(): void - { - $carrier = [BAGGAGE_HEADER_PREFIX.'test' => 'some data']; - - $this->expectException(Exception::class); - $this->expectExceptionMessage('baggage without trace ctx'); - - $this->textCodec->extract($carrier); - } - - public function testInvalidSpanContextParsingFromHeader(): void - { - $carrier = [TRACE_ID_HEADER => 'invalid_data']; - - $this->expectException(Exception::class); - $this->expectExceptionMessage('Malformed tracer state string.'); - - $this->textCodec->extract($carrier); - } - - public function testExtractDebugSpanContext(): void - { - $carrier = [DEBUG_ID_HEADER_KEY => 'debugId']; - - $spanContext = $this->textCodec->extract($carrier); - - $this->assertEquals('debugId', $spanContext->getDebugId()); - $this->assertNull($spanContext->getTraceId()); - $this->assertNull($spanContext->getSpanId()); - $this->assertNull($spanContext->getParentId()); - $this->assertNull($spanContext->getFlags()); - } - - - public function testExtractEmptySpanContext(): void - { - $spanContext = $this->textCodec->extract([]); - $this->assertNull($spanContext); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/ZipkinCodecTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/ZipkinCodecTest.php deleted file mode 100644 index 047caac2e..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Codec/ZipkinCodecTest.php +++ /dev/null @@ -1,104 +0,0 @@ -codec = new ZipkinCodec; - } - - function testInject() - { - // Given - $traceId = 123; - $spanId = 456; - $parentId = 789; - - $spanContext = new SpanContext( - $traceId, - $spanId, - $parentId, - SAMPLED_FLAG - ); - $carrier = []; - - // When - $this->codec->inject($spanContext, $carrier); - - // Then - $this->assertEquals('7b', $carrier['X-B3-TraceId']); - $this->assertEquals('1c8', $carrier['X-B3-SpanId']); - $this->assertEquals('315', $carrier['X-B3-ParentSpanId']); - $this->assertSame(1, $carrier['X-B3-Flags']); - } - - function testExtract() - { - // Given - $carrier = [ - 'x-b3-traceid' => 'a53bf337d7e455e1', - 'x-b3-spanid' => '153bf227d1f455a1', - 'x-b3-parentspanid' => 'a53bf337d7e455e1', - 'x-b3-flags' => '1', - ]; - - // When - $spanContext = $this->codec->extract($carrier); - - // Then - $this->assertEquals(new SpanContext( - '-6540366612654696991', - '1530082751262512545', - '-6540366612654696991', - DEBUG_FLAG - ), $spanContext); - } - - function testExtractWithoutParentSpanId() - { - // Given - $carrier = [ - 'x-b3-traceid' => '8d824d69da5f50d9', - 'x-b3-spanid' => '8d824d69da5f50d9', - 'x-b3-flags' => '1', - ]; - - // When - $spanContext = $this->codec->extract($carrier); - - // Then - $this->assertEquals(new SpanContext( - '-8249946450358742823', - '-8249946450358742823', - '0', - DEBUG_FLAG - ), $spanContext); - } - - function testExtractInvalidHeader() - { - // Given - $carrier = [ - 'x-b3-traceid' => 'zzzz', - 'x-b3-spanid' => '463ac35c9f6413ad48485a3953bb6124', - 'x-b3-flags' => '1', - ]; - - // When - $spanContext = $this->codec->extract($carrier); - - // Then - $this->assertEquals(null, $spanContext); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ConfigTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ConfigTest.php deleted file mode 100644 index da1a9781e..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ConfigTest.php +++ /dev/null @@ -1,257 +0,0 @@ -config = new Config([], $this->serviceName); - $this->reporter = $this->createMock(ReporterInterface::class); - $this->sampler = $this->createmock(SamplerInterface::class); - } - - function testCreateTracer() - { - $tracer = $this->config->createTracer($this->reporter, $this->sampler); - - $this->assertEquals(Tracer::class, get_class($tracer)); - $this->assertEquals($this->serviceName, $tracer->getServiceName()); - } - - function testThrowExceptionWhenServiceNameIsNotDefined() - { - $this->expectException(Exception::class); - $this->expectExceptionMessage('service_name required in the config or param.'); - - new Config([]); - } - - function testSetServiceNameFromConfig() - { - $config = new Config(['service_name' => 'test-service-name-from-config']); - - $serviceName = $config->getServiceName(); - - $this->assertEquals('test-service-name-from-config', $serviceName); - } - - /** - * @test - */ - public function shouldSetGlobalTracerAfterInitialize() - { - //given - $config = new Config(['service_name' => 'test-service-name']); - - //when - $config->initializeTracer(); - - //then - $tracer = GlobalTracer::get(); - $this->assertInstanceOf(Tracer::class, $tracer); - } - - /** @test */ - public function shouldThrowExceptionWhenCreatingNotSupportedSampler() - { - $config = new Config(['service_name' => 'test-service-name', 'sampler' => ['type' => 'unsupportedSampler']]); - - $this->expectException(Exception::class); - $this->expectExceptionMessage('Unknown sampler type unsupportedSampler'); - - $config->initializeTracer(); - } - - /** @test */ - public function shouldThrowExceptionWhenCreatingRateLimitingSamplerWithoutCacheComponent() - { - $config = new Config([ - 'service_name' => 'test-service-name', - 'sampler' => ['type' => \Jaeger\SAMPLER_TYPE_RATE_LIMITING] - ]); - - $this->expectException(Exception::class); - $this->expectExceptionMessage('You cannot use RateLimitingSampler without cache component'); - - $config->initializeTracer(); - } - - /** @test */ - public function shouldPassDifferentDispatchMode() { - foreach (Config::getAvailableDispatchModes() as $dispatchMode) { - $config = new Config( - [ - 'sampler' => [ - 'type' => SAMPLER_TYPE_CONST, - 'param' => true, - ], - 'logging' => false, - "local_agent" => [ - "reporting_host" => "localhost", - ], - 'dispatch_mode' => $dispatchMode, - ], - 'your-app-name' - ); - $config->initializeTracer(); - $this->expectNotToPerformAssertions(); - } - } - - /** @test */ - public function shouldPassConfiguredTagsToTracer() - { - $tags = [ - 'bar' => 'a-value', - 'other.tag' => 'foo', - ]; - - $config = new Config([ - 'sampler' => [ - 'type' => SAMPLER_TYPE_CONST, - 'param' => true, - ], - 'service_name' => 'test-service-name', - 'tags' => $tags, - ]); - - $tracer = $config->initializeTracer(); - $span = $tracer->startSpan('test-span'); - $spanTags = $span->getTags(); - - foreach ($tags as $name => $value) { - $this->assertArrayHasKey($name, $spanTags, "Tag '$name' should be set on span"); - $this->assertEquals($value, $spanTags[$name]->value, "Tag '$name' should have configured value"); - } - } - - /** - * @test - * @dataProvider shouldSetConfigPropertiesFromEnvVarsProvider - */ - public function shouldSetConfigPropertiesFromEnvVars($varName, $varVal, $initialConfig, $valueGetter, $expectedVal) - { - $_ENV[$varName] = $varVal; - - $config = new Config([]); - $configProperty = (new \ReflectionObject($config))->getProperty('config'); - $configProperty->setAccessible('true'); - $configArray = $configProperty->getValue($config); - - $this->assertSame($expectedVal, $valueGetter($configArray)); - } - - /** - * @test - * @dataProvider shouldSetConfigPropertiesFromEnvVarsProvider - */ - public function shouldNotSetConfigPropertiesFromEnvVars($varName, $varVal, $initialConfig, $valueGetter, $expectedVal) - { - $_ENV[$varName] = $varVal; - - $config = new Config($initialConfig); - $configProperty = (new \ReflectionObject($config))->getProperty('config'); - $configProperty->setAccessible('true'); - $configArray = $configProperty->getValue($config); - - $this->assertNotEquals($expectedVal, $valueGetter($configArray)); - } - - /** - * 0 -> varName - * 1 -> varVal - * 2 -> initialConfig - * 3 -> valueGetter - * 4 -> expectedVal - */ - public function shouldSetConfigPropertiesFromEnvVarsProvider() { - return [ - [ - 'JAEGER_SERVICE_NAME', - 'some-str', - ['service_name' => 'some-other-str'], - function ($a) { return $a['service_name']; }, - 'some-str', - ], - [ - 'JAEGER_TAGS', - 'some-str', - ['tags' => 'some-other-str'], - function ($a) { return $a['tags']; }, - 'some-str', - ], - [ - 'JAEGER_AGENT_HOST', - 'some-str', - ['local_agent' => ['reporting_host' => 'some-other-str']], - function ($a) { return $a['local_agent']['reporting_host'];}, - 'some-str', - ], - [ - 'JAEGER_AGENT_PORT', - '2222', - ['local_agent' => ['reporting_port' => 1111]], - function ($a) { return $a['local_agent']['reporting_port']; }, - 2222, - ], - [ - 'JAEGER_REPORTER_LOG_SPANS', - 'true', - ['logging' => false], - function ($a) { return $a['logging']; }, - true, - ], - [ - 'JAEGER_REPORTER_MAX_QUEUE_SIZE', - '2222', - ['max_buffer_length' => 1111], - function ($a) { return $a['max_buffer_length']; }, - 2222, - ], - [ - 'JAEGER_SAMPLER_TYPE', - 'some-str', - ['sampler' => ['type' => 'some-other-str']], - function ($a) { return $a['sampler']['type']; }, - 'some-str', - ], - [ - 'JAEGER_SAMPLER_PARAM', - 'some-str', - ['sampler' => ['param' => 'some-other-str']], - function ($a) { return $a['sampler']['param']; }, - 'some-str', - ], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Logger/StackLogger.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Logger/StackLogger.php deleted file mode 100644 index fd8789dc3..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Logger/StackLogger.php +++ /dev/null @@ -1,30 +0,0 @@ -messagesStack[] = $message; - } - - public function getLastMessage() { - return array_pop($this->messagesStack); - } - - public function getMessagesCount() { - return count($this->messagesStack); - } - - public function clear() { - $this->messagesStack = []; - } -} 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', - ], - ], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/CompositeReporterTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/CompositeReporterTest.php deleted file mode 100644 index ef95ebfe7..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/CompositeReporterTest.php +++ /dev/null @@ -1,52 +0,0 @@ -childReporter1 = $this->createMock(ReporterInterface::class); - $this->childReporter2 = $this->createMock(ReporterInterface::class); - - $this->reporter = new CompositeReporter($this->childReporter1, $this->childReporter2); - } - - /** @test */ - public function shouldReportSpan() - { - /** @var \Jaeger\Span|\PHPUnit\Framework\MockObject\MockObject $span */ - $span = $this->createMock(Span::class); - - $this->childReporter1->expects($this->once())->method('reportSpan')->with($span); - $this->childReporter2->expects($this->once())->method('reportSpan')->with($span); - - $this->reporter->reportSpan($span); - } - - /** @test */ - public function shouldCloseReporter() - { - $this->childReporter1->expects($this->once())->method('close'); - $this->childReporter2->expects($this->once())->method('close'); - - $this->reporter->close(); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/InMemoryReporterTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/InMemoryReporterTest.php deleted file mode 100644 index 966a62fa4..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/InMemoryReporterTest.php +++ /dev/null @@ -1,24 +0,0 @@ -createMock(Span::class); - $reporter = new InMemoryReporter(); - - $reporter->reportSpan($span); - $reporter->close(); - - $spans = $reporter->getSpans(); - $this->assertEquals([$span], $spans); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/LoggingReporterTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/LoggingReporterTest.php deleted file mode 100644 index dc7c490d2..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/LoggingReporterTest.php +++ /dev/null @@ -1,31 +0,0 @@ -createMock(NullLogger::class); - $span = $this->createMock(Span::class); - - $reporter = new LoggingReporter($logger); - - $logger->expects($this->once()) - ->method('debug') - ->with($this->stringStartsWith('Reporting span')); - - $reporter->reportSpan($span); - $reporter->close(); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/NullReporterTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/NullReporterTest.php deleted file mode 100644 index e6a66cb8a..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/NullReporterTest.php +++ /dev/null @@ -1,29 +0,0 @@ -createMock(Span::class); - - $reporter = new NullReporter(); - - $reporter->reportSpan($span); - $reporter->close(); - - // Only needed to avoid PhpUnit message: "This test did not perform any assertions" - $this->assertTrue(true); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/RemoteReporterTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/RemoteReporterTest.php deleted file mode 100644 index 0b85f06d0..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Reporter/RemoteReporterTest.php +++ /dev/null @@ -1,46 +0,0 @@ -transport = $this->createMock(UdpSender::class); - $this->reporter = new RemoteReporter($this->transport); - } - - /** @test */ - public function shouldReportSpan() - { - /** @var Span|\PHPUnit\Framework\MockObject\MockObject $span */ - $span = $this->createMock(Span::class); - - $this->transport->expects($this->once())->method('append')->with($span); - - $this->reporter->reportSpan($span); - } - - /** @test */ - public function shouldCloseReporter() - { - $this->transport->expects($this->once())->method('flush'); - $this->transport->expects($this->once())->method('close'); - - $this->reporter->close(); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ConstSamplerTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ConstSamplerTest.php deleted file mode 100644 index 85cb80504..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ConstSamplerTest.php +++ /dev/null @@ -1,43 +0,0 @@ -isSampled($traceId); - - $this->assertEquals($decision, $sampled); - $this->assertEquals([ - SAMPLER_TYPE_TAG_KEY => SAMPLER_TYPE_CONST, - SAMPLER_PARAM_TAG_KEY => $decision, - ], $tags); - - $sampler->close(); - } - - public function samplerProvider() - { - return [ - [true, 1], - [true, PHP_INT_MAX], - [false, 1], - [false, PHP_INT_MAX], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ProbablisticSamplerTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ProbablisticSamplerTest.php deleted file mode 100644 index 2840ebf8c..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/ProbablisticSamplerTest.php +++ /dev/null @@ -1,68 +0,0 @@ -isSampled($traceId); - - $this->assertEquals($decision, $sampled); - $this->assertEquals([ - SAMPLER_TYPE_TAG_KEY => SAMPLER_TYPE_PROBABILISTIC, - SAMPLER_PARAM_TAG_KEY => $rate, - ], $tags); - - $sampler->close(); - } - - public function samplerProvider() - { - return [ - [1.0, PHP_INT_MAX-1, true], - [0, 0, false], - [0.5, PHP_INT_MIN + 10, true], - [0.5, PHP_INT_MAX - 10, false], - ]; - } - - /** - * @test - * @dataProvider rateProvider - * @param mixed $rate - */ - public function shouldThrowOutOfBoundsExceptionInCaseOfInvalidRate($rate) - { - $this->expectException(OutOfBoundsException::class); - $this->expectExceptionMessage('Sampling rate must be between 0.0 and 1.0.'); - - new ProbabilisticSampler($rate); - } - - public function rateProvider() - { - return [ - [1.1], - [-0.1], - [PHP_INT_MAX], - [PHP_INT_MIN], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/RateLimitSamplerTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/RateLimitSamplerTest.php deleted file mode 100644 index 4f6b8a632..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sampler/RateLimitSamplerTest.php +++ /dev/null @@ -1,48 +0,0 @@ -isSampled(); - list($sampled, $tags) = $sampler->isSampled(); - $this->assertEquals($decision, $sampled); - $this->assertEquals([ - SAMPLER_TYPE_TAG_KEY => SAMPLER_TYPE_RATE_LIMITING, - SAMPLER_PARAM_TAG_KEY => $maxTracesPerSecond, - ], $tags); - - $sampler->close(); - } - - public function maxRateProvider() - { - return [ - [1000000, true], - [1, false], - [0, false], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeManagerTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeManagerTest.php deleted file mode 100644 index 43a303642..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeManagerTest.php +++ /dev/null @@ -1,49 +0,0 @@ -scopeManager = new ScopeManager(); - } - - function testActivate() - { - $span = $this->createMock(Span::class); - - $scope = $this->scopeManager->activate($span, true); - - $this->assertEquals($scope->getSpan(), $span); - } - - function testAbleGetActiveScope() - { - $span = $this->createMock(Span::class); - - $this->assertNull($this->scopeManager->getActive()); - $scope = $this->scopeManager->activate($span, false); - - $this->assertEquals($scope, $this->scopeManager->getActive()); - } - - function testScopeClosingDeactivates() - { - $span = $this->createMock(Span::class); - - $scope = $this->scopeManager->activate($span, false); - $scope->close(); - - $this->assertNull($this->scopeManager->getActive()); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeTest.php deleted file mode 100644 index e36a8de3d..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ScopeTest.php +++ /dev/null @@ -1,58 +0,0 @@ -scopeManager = $this->createMock(ScopeManager::class); - $this->span = $this->createMock(Span::class); - } - - function testCloseDoNotFinishSpanOnClose() - { - $scope = new Scope($this->scopeManager, $this->span, false); - - $this->scopeManager->method('getActive')->willReturn($scope); - $this->scopeManager->expects($this->once())->method('getActive'); - $this->span->expects($this->never())->method('finish'); - $this->scopeManager->expects($this->once())->method('setActive'); - - $scope->close(); - } - - function testCloseFinishSpanOnClose() - { - $scope = new Scope($this->scopeManager, $this->span, true); - - $this->scopeManager->method('getActive')->willReturn($scope); - $this->scopeManager->expects($this->once())->method('getActive'); - $this->span->expects($this->once())->method('finish'); - $this->scopeManager->expects($this->once())->method('setActive'); - - $scope->close(); - } - - function testGetSpan() - { - $scope = new Scope($this->scopeManager, $this->span, false); - - $this->assertEquals($this->span, $scope->getSpan()); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/JaegerThriftSenderTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/JaegerThriftSenderTest.php deleted file mode 100644 index 5bd6d0a7b..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/JaegerThriftSenderTest.php +++ /dev/null @@ -1,126 +0,0 @@ -createMock(Tracer::class); - $tracer->method('getIpAddress')->willReturn(''); - $tracer->method('getServiceName')->willReturn(''); - - $this->tracer = $tracer; - - $context = $this->createMock(SpanContext::class); - $this->context = $context; - } - - public function testFlush(): void - { - - $span = $this->createMock(Span::class); - $span->method('getOperationName')->willReturn('dummy-operation'); - $span->method('getTracer')->willReturn($this->tracer); - $span->method('getContext')->willReturn($this->context); - - $client = $this->createMock(AgentClient::class); - $sender = new JaegerSender($client); - $sender->setMaxBufferLength(64000); - - $client - ->expects(self::exactly(1)) - ->method('emitBatch'); - - $sender->append($span); - $sender->append($span); - $sender->append($span); - - self::assertEquals(3, $sender->flush()); - } - - public function testEmitBatch() { - $client = $this->createMock(AgentClient::class); - $sender = new JaegerSender($client); - $sender->setMaxBufferLength(64000); - - $span = $this->createMock(Span::class); - $span->method('getOperationName')->willReturn('dummy-operation'); - $span->method('getTracer')->willReturn($this->tracer); - $span->method('getContext')->willReturn($this->context); - - $client - ->expects($this->once()) - ->method('emitBatch') - ->with($this->callback(function ($batch) { - /** @var Batch $batch */ - $this->assertInstanceOf(Batch::class, $batch); - $this->assertCount(1, $batch->spans); - - /** @var \Jaeger\Thrift\Span $span */ - $span = $batch->spans[0]; - $this->assertInstanceOf(\Jaeger\Thrift\Span::class, $span); - $this->assertSame("dummy-operation", $span->operationName); - - return true; - - })); - - $sender->append($span); - $this->assertEquals(1, $sender->flush()); - } - - public function testMaxBufferLength() { - $tracer = $this->createMock(Tracer::class); - $tracer->method('getIpAddress')->willReturn(''); - $tracer->method('getServiceName')->willReturn(''); - - $context = $this->createMock(SpanContext::class); - - $span = $this->createMock(Span::class); - $span->method('getOperationName')->willReturn('dummy-operation'); - $span->method('getTracer')->willReturn($tracer); - $span->method('getContext')->willReturn($context); - - $client = $this->createMock(AgentClient::class); - - $mockBuilder = $this->getMockBuilder(JaegerSender::class); - $mockMethods = ['emitJaegerBatch']; - if (method_exists($mockBuilder, "onlyMethods")) { - $mockBuilder = $mockBuilder->onlyMethods($mockMethods); - } else { - $mockBuilder = $mockBuilder->setMethods($mockMethods); - } - $sender = $mockBuilder->setConstructorArgs([$client])->getMock(); - $sender->setMaxBufferLength(800); - $sender->expects(self::exactly(2)) - ->method('emitJaegerBatch') - ->withConsecutive( - [self::countOf(2)], - [self::countOf(1)] - ); - - // jaeger batch overhead parameter = 512 - $sender->append($span); // 512 + 143 < 800 - chunk 1 - $sender->append($span); // 512 + 143*2 => 798 < 800 - chunk 1 - $sender->append($span); // 512 + 143*3 > 800 - chunk 2 - - self::assertEquals(3, $sender->flush()); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/UdpSenderTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/UdpSenderTest.php deleted file mode 100644 index 9011d00e3..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/Sender/UdpSenderTest.php +++ /dev/null @@ -1,116 +0,0 @@ -client = $this->createMock(AgentClient::class); - $this->sender = new UdpSender($this->client, 64000); - } - - public function testMaxBufferLength(): void - { - $tracer = $this->createMock(Tracer::class); - $tracer->method('getIpAddress')->willReturn(''); - $tracer->method('getServiceName')->willReturn(''); - - $context = $this->createMock(SpanContext::class); - - $span = $this->createMock(Span::class); - $span->method('getOperationName')->willReturn('dummy-operation'); - $span->method('getTracer')->willReturn($tracer); - $span->method('getContext')->willReturn($context); - - $sender = new UdpSender($this->client, 100); - - $this->client - ->expects(self::exactly(2)) - ->method('emitZipkinBatch') - ->withConsecutive( - [self::countOf(2)], - [self::countOf(1)] - ); - - // one span has a length of ~25 - $sender->append($span); // 30 + 25 < 100 - chunk 1 - $sender->append($span); // 30 + 25 * 2 < 100 - chunk 1 - $sender->append($span); // 30 + 25 * 3 > 100 - chunk 2 - - self::assertEquals(3, $sender->flush()); - } - - public function testFlush(): void - { - $this->assertEquals(0, $this->sender->flush()); - - $logTimeStamp = (int) (microtime(true) * 1000000); - - $tracer = $this->createMock(Tracer::class); - $tracer->method('getIpAddress')->willReturn(''); - $tracer->method('getServiceName')->willReturn(''); - $context = $this->createMock(SpanContext::class); - $span = $this->createMock(Span::class); - $span->method('getTracer')->willReturn($tracer); - $span->method('getContext')->willReturn($context); - $span - ->expects($this->atLeastOnce()) - ->method('getLogs') - ->willReturn([ - [ - 'timestamp' => $logTimeStamp, - 'fields' => [ - 'foo' => 'bar', - ], - ], - ]); - - $this->client - ->expects($this->once()) - ->method('emitZipkinBatch') - ->with($this->callback(function ($spans) use ($logTimeStamp) { - $this->assertCount(1, $spans); - - /* @var $annotation ZipkinSpan */ - $span = $spans[0]; - $this->assertInstanceOf(ZipkinSpan::class, $span); - $this->assertCount(1, $span->annotations); - - /* @var $annotation ZipkinAnnotation */ - $annotation = $span->annotations[0]; - $this->assertInstanceOf(ZipkinAnnotation::class, $annotation); - $this->assertSame($logTimeStamp, $annotation->timestamp); - $this->assertSame( - json_encode([ - 'foo' => 'bar', - ]), - $annotation->value - ); - - return true; - })); - - $this->sender->append($span); - $this->assertEquals(1, $this->sender->flush()); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanContextTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanContextTest.php deleted file mode 100644 index 998061088..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanContextTest.php +++ /dev/null @@ -1,37 +0,0 @@ -assertTrue($ctx->isDebugIdContainerOnly()); - $this->assertEquals($ctx->getDebugId(), 'value1'); - - $ctx = new SpanContext(1, 2, 3, 1); - $this->assertFalse($ctx->isDebugIdContainerOnly()); - } - - /** - * @dataProvider contextDataProvider - */ - public function testBaggageInit($traceId, $spanId, $parentId, $flags, $baggage, $expected) - { - $ctx = new SpanContext($traceId, $spanId, $parentId, $flags, $baggage); - $this->assertEquals($expected, $ctx->getBaggage()); - } - - public function contextDataProvider() - { - return [ - [null, null, null, null, [], []], - [null, null, null, null, null, []], - [null, null, null, null, ['key' => 'val'], ['key' => 'val']], - ]; - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanTest.php deleted file mode 100644 index d23879680..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/SpanTest.php +++ /dev/null @@ -1,293 +0,0 @@ -tracer = new Tracer('test-service', 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 - { - $tags = [ - 'foo-1' => 'test-component-1', - 'foo-2' => 'test-component-2', - 'foo-3' => 'test-component-3', - ]; - - $span = new Span($this->context, $this->tracer, 'test-operation', $tags); - - $this->assertEquals( 3, count($span->getTags())); - $this->assertEquals($this->tracer, $span->getTracer()); - $this->assertEquals(false, $span->isDebug()); - $this->assertEquals(null, $span->getEndTime()); - } - - /** @test */ - public function shouldSetComponentThroughTag(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - - $span->setTag('component', 'libredis'); - - $spanReflection = new \ReflectionClass(Span::class); - $component = $spanReflection->getProperty('component'); - $component->setAccessible(true); - - $this->assertEquals( 0, count($span->getTags())); - $this->assertEquals( 'libredis', $component->getValue($span)); - $this->assertEquals( 'libredis', $span->getComponent()); - } - - /** @test */ - public function shouldSetTags(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - - $this->assertEquals( 0, count($span->getTags())); - - $span->setTags([ - 'foo-1' => 'test-component-1', - 'foo-2' => 'test-component-2', - 'foo-3' => 'test-component-3', - ]); - - $this->assertEquals( 3, count($span->getTags())); - } - - /** @test */ - public function shouldSetDifferentTypeOfTags() { - $span = new Span($this->context, $this->tracer, 'test-operation'); - - $this->assertEquals( 0, count($span->getTags())); - - $span->setTags([ - 'tag-bool1' => true, - 'tag-bool2' => false, - 'tag-int' => 1234567, - 'tag-float' => 1.23456, - 'tag-string' => "hello-world" - ]); - - $tags = array_values($span->getTags()); - $this->assertEquals( 5, count($tags)); - - $index = 0; - $this->assertTrue($tags[$index]->annotation_type === AnnotationType::BOOL); - $this->assertTrue($tags[$index]->value === true); - $this->assertTrue($tags[$index]->key === 'tag-bool1'); - $index++; - - $this->assertTrue($tags[$index]->annotation_type === AnnotationType::BOOL); - $this->assertTrue($tags[$index]->value === false); - $this->assertTrue($tags[$index]->key === 'tag-bool2'); - $index++; - - $this->assertTrue($tags[$index]->annotation_type === AnnotationType::I64); - $this->assertTrue($tags[$index]->value === 1234567); - $this->assertTrue($tags[$index]->key === 'tag-int'); - $index++; - - $this->assertTrue($tags[$index]->annotation_type === AnnotationType::DOUBLE); - $this->assertTrue($tags[$index]->value === 1.23456); - $this->assertTrue($tags[$index]->key === 'tag-float'); - $index++; - - $this->assertTrue($tags[$index]->annotation_type === AnnotationType::STRING); - $this->assertTrue($tags[$index]->value === "hello-world"); - $this->assertTrue($tags[$index]->key === 'tag-string'); - } - - /** @test */ - public function shouldOverwriteTheSameTag(): void - { - // Given - $span = new Span($this->context, $this->tracer, 'test-operation'); - - // When - $span->setTag('foo', 'test-component-1'); - $span->setTag('foo', 'test-component-2'); - - // Then - $this->assertEquals( 1, count($span->getTags())); - $this->assertEquals( 'test-component-2', $span->getTags()['foo']->value); - } - /** @test */ - public function shouldAddLogRecordsToTheSpan(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - - $fields01 = [ - 'event' => 'error', - 'message' => 'dummy error message', - ]; - $fields02 = [ - 'foo' => 'bar', - ]; - - $dateTime01 = new \DateTime('+5 seconds'); - $dateTime02 = $dateTime01->getTimestamp(); - $dateTime03 = microtime(true) + 5; - - $span->log($fields01, $dateTime01); - $span->log($fields02, $dateTime01->getTimestamp()*1000000); - $span->log($fields02, $dateTime03); - $span->log($fields02); - - $logs = $span->getLogs(); - - $this->assertCount(4, $logs); - - $this->assertIsInt($logs[0]['timestamp']); - $this->assertEquals((int)($dateTime01->format('U.u')*1000000), $logs[0]['timestamp']); - $this->assertSame($fields01, $logs[0]['fields']); - - $this->assertIsInt($logs[1]['timestamp']); - $this->assertSame($dateTime02*1000000, $logs[1]['timestamp']); - $this->assertSame($fields02, $logs[1]['fields']); - - $this->assertIsInt($logs[2]['timestamp']); - $this->assertSame((int) ($dateTime03 * 1000000), $logs[2]['timestamp']); - $this->assertSame($fields02, $logs[2]['fields']); - - $this->assertIsInt($logs[3]['timestamp']); - $this->assertSame($fields02, $logs[3]['fields']); - } - - /** @test */ - public function timingDefaultTimes(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $span->finish(); - - $this->assertEquals(0.0, round(($span->getEndTime() - $span->getStartTime()) / 1000000)); - } - - /** @test */ - public function timingSetStartTimeAsDateTime(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation', [], new \DateTime('-2 seconds')); - $span->finish(); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetEndTimeAsDateTime(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - - $endTime = new \DateTime('+2 seconds'); - // add microseconds because php < 7.1 has a bug - // https://bugs.php.net/bug.php?id=48225 - if (version_compare(phpversion(), '7.1', '<')) { - list($usec) = explode(' ', microtime()); - $endTime = \DateTime::createFromFormat('U.u', $endTime->format('U')+$usec); - } - $span->finish($endTime); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetStartTimeAsInt(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation', [], (int) round((microtime(true) - 2) * 1000000)); - $span->finish(); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetEndTimeAsInt(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $span->finish((int) round((microtime(true) + 2) * 1000000)); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetStartTimeAsFloat(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation', [], microtime(true) - 2); - $span->finish(); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetEndTimeAsFloat(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $span->finish(microtime(true) + 2); - - $this->assertSpanDuration($span); - } - - /** @test */ - public function timingSetMixedTimes(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation', [], new \DateTime()); - $span->finish(microtime(true) + 2); - - $this->assertSpanDuration($span); - } - - protected function assertSpanDuration(Span $span): void - { - $this->assertEquals(2, (int)(($span->getEndTime() - $span->getStartTime()) / 1000000)); - } - - /** @test */ - public function invalidStartTime(): void - { - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('Time should be one of the types int|float|DateTime|null, got string.'); - $span = new Span($this->context, $this->tracer, 'test-operation', [], 'string'); - } - - /** @test */ - public function invalidEndTime(): void - { - $span = new Span($this->context, $this->tracer, 'test-operation'); - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('Time should be one of the types int|float|DateTime|null, got array.'); - $span->finish([]); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ThriftUdpTransportTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ThriftUdpTransportTest.php deleted file mode 100644 index abc4e32aa..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/ThriftUdpTransportTest.php +++ /dev/null @@ -1,166 +0,0 @@ -logger = new StackLogger(); - $this->transport = new ThriftUdpTransport('127.0.0.1', 12345, $this->logger); - } - - public function testisOpenWhenOpen() - { - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->assertTrue($this->transport->isOpen()); - $this->assertEquals($this->logger->getMessagesCount(), 0); - } - - public function testisOpenWhenClosed() - { - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->close(); - $this->assertFalse($this->transport->isOpen()); - $this->assertEquals($this->logger->getMessagesCount(), 0); - } - - public function testClose() - { - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->close(); - - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->write('hello'); - $this->assertEquals($this->logger->getMessagesCount(), 1); - $this->assertEquals($this->logger->getLastMessage(), 'transport is closed'); - $this->assertEquals($this->logger->getMessagesCount(), 0); - } - - public function testDoubleClose() - { - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->close(); - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->close(); - $this->assertEquals($this->logger->getMessagesCount(), 1); - $this->assertEquals( - $this->logger->getLastMessage(), - "can't close empty socket" - ); - } - - public function testException() - { - $this->assertEquals($this->logger->getMessagesCount(), 0); - $this->transport->open(); - $this->assertEquals($this->logger->getMessagesCount(), 0); - - $this->transport->write(str_repeat("some string", 10000)); - - $this->assertEquals($this->logger->getMessagesCount(), 1); - $msg = $this->logger->getLastMessage(); - $pattern = "/socket_write failed: \[code - \d+\] Message too long/"; - - if (method_exists($this, "assertMatchesRegularExpression")) { - $this->assertMatchesRegularExpression($pattern, $msg); - } else { - $this->assertRegExp($pattern, $msg); - } - } - - public function testProtocolVersionIPv4() - { - $config = new Config([ - Config::IP_VERSION => Config::IPV4 - ], "testServiceName"); - - $transport = new ThriftUdpTransport('127.0.0.1', 12345, $this->logger, $config); - - $reflectionTransport = new \ReflectionClass($transport); - $ipProtocolVersionMethod = $reflectionTransport->getMethod("ipProtocolVersion"); - $ipProtocolVersionMethod->setAccessible(true); - - $this->assertEquals(Config::IPV4, $ipProtocolVersionMethod->invoke($transport)); - } - - public function testProtocolVersionIPv6() - { - $config = new Config([ - Config::IP_VERSION => Config::IPV6 - ], "testServiceName"); - - $transport = new ThriftUdpTransport('127.0.0.1', 12345, $this->logger, $config); -// - $reflectionTransport = new \ReflectionClass($transport); - $ipProtocolVersionMethod = $reflectionTransport->getMethod("ipProtocolVersion"); - $ipProtocolVersionMethod->setAccessible(true); -// - $this->assertEquals(Config::IPV6, $ipProtocolVersionMethod->invoke($transport)); - } - - public function testProtocolVersionDefault() - { - $config = new Config([ - ], "testServiceName"); - - $transport = new ThriftUdpTransport('127.0.0.1', 12345, $this->logger, $config); - - $reflectionTransport = new \ReflectionClass($transport); - $ipProtocolVersionMethod = $reflectionTransport->getMethod("ipProtocolVersion"); - $ipProtocolVersionMethod->setAccessible(true); - - $this->assertEquals(Config::IPV4, $ipProtocolVersionMethod->invoke($transport)); - } - - public function testCreateSocket() - { - $transport = $this->getMockBuilder(ThriftUdpTransport::class) - ->disableOriginalConstructor() - ->getMock(); - - $reflectionClass = new \ReflectionClass($transport); - $method = $reflectionClass->getMethod("setLogger"); - $method->setAccessible(true); - $method->invokeArgs($transport, [$this->logger]); - - $method = $reflectionClass->getMethod("createSocket"); - $method->setAccessible(true); - $res = $method->invokeArgs($transport, [Config::IPV6]); - - $this->assertNotFalse($res); - - - $transport = $this->getMockBuilder(ThriftUdpTransport::class) - ->disableOriginalConstructor() - ->getMock(); - - $reflectionClass = new \ReflectionClass($transport); - $method = $reflectionClass->getMethod("setLogger"); - $method->setAccessible(true); - $method->invokeArgs($transport, [$this->logger]); - - $method = $reflectionClass->getMethod("createSocket"); - $method->setAccessible(true); - $res = $method->invokeArgs($transport, [Config::IPV4]); - - $this->assertNotFalse($res); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/TracerTest.php b/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/TracerTest.php deleted file mode 100644 index 3e7b4c05f..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/Jaeger/TracerTest.php +++ /dev/null @@ -1,262 +0,0 @@ -scopeManager = $this->createMock(ScopeManager::class); - $this->sampler = $this->createMock(SamplerInterface::class); - $this->reporter = $this->createMock(ReporterInterface::class); - $this->logger = new NullLogger(); - - $this->tracer = new Tracer($this->serviceName, $this->reporter, $this->sampler, true, $this->logger, $this->scopeManager); - } - - public function testStartSpan(): void - { - $span = $this->tracer->startSpan($this->operationName); - - $this->assertEquals($this->operationName, $span->getOperationName()); - } - - public function testStartActiveSpan(): void - { - $tracer = new Tracer($this->serviceName, $this->reporter, $this->sampler); - - $tracer->startActiveSpan('test-operation1'); - $this->assertEquals('test-operation1', $tracer->getActiveSpan()->getOperationName()); - - $scope = $tracer->startActiveSpan('test-operation2'); - $this->assertEquals('test-operation2', $tracer->getActiveSpan()->getOperationName()); - $scope->close(); - - $this->assertEquals('test-operation1', $tracer->getActiveSpan()->getOperationName()); - } - - /** @test */ - public function shouldAddConfiguredTagsToStartedSpanWhenSampled(): void - { - $this->sampler->expects($this->any()) - ->method('isSampled') - ->willReturn([true, []]); - - $tags = [ - 'bar' => 'a-value', - 'other.tag' => 'foo', - ]; - - $tracer = new Tracer( - $this->serviceName, - $this->reporter, - $this->sampler, - true, - $this->logger, - $this->scopeManager, - TRACE_ID_HEADER, - BAGGAGE_HEADER_PREFIX, - DEBUG_ID_HEADER_KEY, - $tags - ); - - $span = $tracer->startSpan('test-span'); - $spanTags = $span->getTags(); - - foreach ($tags as $name => $value) { - $this->assertArrayHasKey($name, $spanTags, "Tag '$name' should be set on span"); - $this->assertEquals($value, $spanTags[$name]->value, "Tag '$name' should have configured value"); - } - } - - /** @test */ - public function shouldAddNoConfiguredTagsToStartedSpanWhenNotSampled(): void - { - $this->sampler->expects($this->any()) - ->method('isSampled') - ->willReturn([false, []]); - - $tags = [ - 'bar' => 'a-value', - 'other.tag' => 'foo', - ]; - - $tracer = new Tracer( - $this->serviceName, - $this->reporter, - $this->sampler, - true, - $this->logger, - $this->scopeManager, - TRACE_ID_HEADER, - BAGGAGE_HEADER_PREFIX, - DEBUG_ID_HEADER_KEY, - $tags - ); - - $span = $tracer->startSpan('test-span'); - - $this->assertEquals([], $span->getTags(), 'No tags should be set when not sampled'); - } - - /** @test */ - public function shouldThrowExceptionOnInvalidFormat(): void - { - $spanContext = new SpanContext(0, 0, 0, 0); - $carrier = []; - - $this->expectException(UnsupportedFormatException::class); - $this->expectExceptionMessage('The format "bad-format" is not supported.'); - - $this->tracer->inject($spanContext, 'bad-format', $carrier); - $this->assertSame([], $carrier); - } - - /** @test */ - public function shouldNotThrowExceptionOnInvalidContext(): void - { - $spanContext = new NoopSpanContext(); - $carrier = []; - - $this->tracer->inject($spanContext, ZIPKIN_SPAN_FORMAT, $carrier); - $this->assertSame([], $carrier); - } - - /** @test */ - public function shouldInjectSpanContextToCarrier(): void - { - $spanContext = new SpanContext(0, 0, 0, 0); - $carrier = []; - - $this->tracer->inject($spanContext, TEXT_MAP, $carrier); - - $this->assertCount(1, $carrier); - $this->assertEquals('0:0:0:0', $carrier[TRACE_ID_HEADER]); - } - - /** @test */ - public function shouldThrowExceptionOnExtractInvalidFormat(): void - { - $this->expectException(UnsupportedFormatException::class); - $this->expectExceptionMessage('The format "bad-format" is not supported.'); - - $this->tracer->extract('bad-format', []); - } - - /** @test */ - public function shouldNotThrowExceptionOnExtractFromMalformedState(): void - { - $this->assertNull($this->tracer->extract(TEXT_MAP, ['uber-trace-id' => ''])); - } - - /** @test */ - public function shouldExtractSpanContextFromCarrier(): void - { - $carrier = ['uber-trace-id' => '32834e4115071776:f7802330248418d:f123456789012345:1']; - - $this->assertInstanceOf(SpanContext::class, $this->tracer->extract(TEXT_MAP, $carrier)); - } - - public function testGetScopeManager() - { - $this->assertEquals($this->scopeManager, $this->tracer->getScopeManager()); - } - - public function testGetActiveSpan(): void - { - $span = $this->createMock(Span::class); - $scope = $this->createMock(Scope::class); - $scope->expects($this->once())->method('getSpan')->willReturn($span); - - $this->scopeManager->expects($this->once())->method('getActive')->willReturn($scope); - - $this->assertEquals($span, $this->tracer->getActiveSpan()); - } - - public function testGetActiveSpanNull(): void - { - $this->scopeManager->expects($this->once())->method('getActive')->willReturn(null); - - $this->assertEquals(null, $this->tracer->getActiveSpan()); - } - - public function testFlush(): void - { - $this->reporter->expects($this->once())->method('close'); - - $this->tracer->flush(); - } - - /** @test */ - public function shouldHandleEmptyHostName(): void - { - $tracer = new \ReflectionClass(Tracer::class); - - $getHostByName = $tracer->getMethod('getHostByName'); - $getHostByName->setAccessible(true); - - $stub = $this->getMockBuilder(Tracer::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - - $logger = $tracer->getProperty('logger'); - $logger->setAccessible(true); - $logger->setValue($stub, $this->logger); - - $this->assertEquals('127.0.0.1', $getHostByName->invokeArgs($stub, [null])); - } -} diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/README.md b/vendor/jonahgeorge/jaeger-client-php/tests/README.md deleted file mode 100644 index aa828030f..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Jaeger Bindings for PHP OpenTracing API: Unit Tests - -Welcome to the Jaeger Testing Suite. - -This folder includes all the unit tests that test Jaeger components, ensuring that you enjoy a bug free library. - -## Current PHP Support - -| version | status | -|---------|--------| -| 7.0 | ✔ | -| 7.1 | ✔ | -| 7.2 | ✔ | - - -## Getting Started - -This testing suite uses [Travis CI](https://travis-ci.org/) for each run. -Every commit pushed to this repository will queue a build into the continuous integration service and will run all tests -to ensure that everything is going well and the project is stable. - -The testing suite can be run on your own machine. The main dependency is [PHPUnit](https://phpunit.de/) -which can be installed using [Composer](https://getcomposer.org/): - -```bash -# run this command from project root -$ composer install -``` - -Then run the tests by calling command from the terminal as follows: - -```bash -$ composer test -``` - -## Run Tests for Supported Versions - -There is also an ability to run tests for different PHP versions. To achieve this we offer use -[docker](https://docs.docker.com/install/)-based approach: - -```bash - -$ docker run --rm -it -v $(pwd):/usr/app php:7.0 ./usr/app/tests/php-test.sh - -$ docker run --rm -it -v $(pwd):/usr/app php:7.1 ./usr/app/tests/php-test.sh - -$ docker run --rm -it -v $(pwd):/usr/app php:7.2 ./usr/app/tests/php-test.sh -``` diff --git a/vendor/jonahgeorge/jaeger-client-php/tests/php-test.sh b/vendor/jonahgeorge/jaeger-client-php/tests/php-test.sh deleted file mode 100644 index 99a522856..000000000 --- a/vendor/jonahgeorge/jaeger-client-php/tests/php-test.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash - -# trace ERR through pipes -set -o pipefail - -# trace ERR through 'time command' and other functions -set -o errtrace - -# set -u : exit the script if you try to use an uninitialised variable -set -o nounset - -# set -e : exit the script if any statement returns a non-true return value -set -o errexit - -# to avoid message: -# "Do not run Composer as root/super user! See https://getcomposer.org/root for details" -export COMPOSER_ALLOW_SUPERUSER=1 - -export TERM=xterm-256color - -echo "[INFO]: Install OS dependencies..." -apt-get update -yq > /dev/null 2>&1 -apt-get install -yq git wget unzip zip > /dev/null 2>&1 - -echo "[INFO]: Install PHP extensions..." -docker-php-ext-install bcmath sockets > /dev/null 2>&1 -pecl install hrtime > /dev/null 2>&1 -docker-php-ext-enable hrtime > /dev/null 2>&1 - -echo "[INFO]: Install Xdebug to enable code coverage..." -pecl install xdebug > /dev/null 2>&1 -docker-php-ext-enable xdebug > /dev/null 2>&1 - -cd /tmp - -echo "[INFO]: Install Composer..." -EXPECTED_SIGNATURE="$(wget -q -O - https://composer.github.io/installer.sig)" -php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" -ACTUAL_SIGNATURE="$(php -r "echo hash_file('SHA384', 'composer-setup.php');")" - -if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then - >&2 echo '[ERROR]: Invalid installer signature' - rm composer-setup.php - exit 1 -fi - -php composer-setup.php --quiet -rm composer-setup.php - -# this step is required to be able to overwrite composer.lock -cp -R /usr/app /usr/tests - -cd /usr/tests -rm -f composer.lock - -echo "[INFO]: Install library dependencies..." -php /tmp/composer.phar install \ - --no-interaction \ - --no-ansi \ - --no-progress \ - --no-suggest - -echo -e "[INFO]: Run tests...\n" -/tmp/composer.phar test -- cgit v1.2.3