diff --git a/.travis.yml b/.travis.yml index d59c90e..a727d54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,45 @@ jobs: env: SYMFONY_VERSION="5.0.*" - php: '7.4' env: SYMFONY_VERSION="5.0.*" + - stage: test-functional + php: '7.4' + env: + - SYMFONY_VERSION="3.4.*" + - BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} + services: docker + before_script: + - wget https://get.symfony.com/cli/installer -O - | bash + - sudo mv /home/travis/.symfony/bin/symfony /usr/local/bin/symfony + script: + - composer run-script phpunit-functional + after_success: + - docker ps + - stage: test-functional + php: '7.4' + env: + - SYMFONY_VERSION="4.4.*" + - BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} + services: docker + before_script: + - wget https://get.symfony.com/cli/installer -O - | bash + - sudo mv /home/travis/.symfony/bin/symfony /usr/local/bin/symfony + script: + - composer run-script phpunit-functional + after_success: + - docker ps + - stage: test-functional + php: '7.4' + env: + - SYMFONY_VERSION="5.0.*" + - BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} + services: docker + before_script: + - wget https://get.symfony.com/cli/installer -O - | bash + - sudo mv /home/travis/.symfony/bin/symfony /usr/local/bin/symfony + script: + - composer run-script phpunit-functional + after_success: + - docker ps before_install: - composer global require hirak/prestissimo diff --git a/README.md b/README.md index 06ffba3..0fe5649 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,13 @@ # auxmoney OpentracingBundle - Jaeger +![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/auxmoney/OpentracingBundle-Jaeger) +![Travis (.org)](https://img.shields.io/travis/auxmoney/OpentracingBundle-Jaeger) +![Coveralls github](https://img.shields.io/coveralls/github/auxmoney/OpentracingBundle-Jaeger) +![Codacy Badge](https://api.codacy.com/project/badge/Grade/dd11fb9bdbe54affb1946a03af5f432a) +![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/auxmoney/OpentracingBundle-Jaeger) +![Scrutinizer code quality (GitHub/Bitbucket)](https://img.shields.io/scrutinizer/quality/g/auxmoney/OpentracingBundle-Jaeger) +![GitHub](https://img.shields.io/github/license/auxmoney/OpentracingBundle-Jaeger) + This symfony bundle provides a tracer implementation for [Jaeger](https://www.jaegertracing.io/) for the [auxmoney OpentracingBundle](https://github.com/auxmoney/OpentracingBundle-core). Please have a look at [the central documentation](https://github.com/auxmoney/OpentracingBundle-core) for installation and usage instructions. diff --git a/Tests/Functional/FunctionalTest.php b/Tests/Functional/FunctionalTest.php new file mode 100644 index 0000000..8fa693f --- /dev/null +++ b/Tests/Functional/FunctionalTest.php @@ -0,0 +1,25 @@ +setUpTestProject('default'); + + $p = new Process(['symfony', 'console', 'test:jaeger'], 'build/testproject'); + $p->mustRun(); + $output = $p->getOutput(); + $traceId = substr($output, 0, strpos($output, ':')); + self::assertNotEmpty($traceId); + + $spans = $this->getSpansFromTrace($this->getTraceFromJaegerAPI($traceId)); + self::assertCount(1, $spans); + self::assertSame('test:jaeger', $spans[0]['operationName']); + } +} diff --git a/Tests/Functional/TestProjectFiles/default/src/Command/TestCommand.php b/Tests/Functional/TestProjectFiles/default/src/Command/TestCommand.php new file mode 100644 index 0000000..ed4e974 --- /dev/null +++ b/Tests/Functional/TestProjectFiles/default/src/Command/TestCommand.php @@ -0,0 +1,31 @@ +setDescription('some fancy command description'); + $this->opentracing = $opentracing; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $carrier = []; + $this->opentracing->getTracerInstance()->inject($this->opentracing->getTracerInstance()->getActiveSpan()->getContext(), TEXT_MAP, $carrier); + $output->writeln(current($carrier)); + return 0; + } +} diff --git a/composer.json b/composer.json index 07ffd3d..65e2890 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,11 @@ "phpstan/phpstan": "^0.12", "squizlabs/php_codesniffer": "^3.5", "phpmd/phpmd": "^2.7", - "php-coveralls/php-coveralls": "^2.2" + "php-coveralls/php-coveralls": "^2.2", + "symfony/filesystem": "*", + "symfony/process": "*", + "symfony/yaml": "*", + "mtdowling/jmespath.php": "^2.5" }, "autoload": { "psr-4": { @@ -49,7 +53,14 @@ ], "phpmd": "vendor/bin/phpmd . text cleancode,codesize,controversial,design,naming,unusedcode --exclude vendor,Tests", "phpcs": "vendor/bin/phpcs", - "phpunit": "phpdbg -qrr vendor/bin/phpunit --colors=never", + "phpunit": "phpdbg -qrr vendor/bin/phpunit --colors=never --testsuite=unit", + "phpunit-functional": [ + "vendor/auxmoney/opentracing-bundle-core/Tests/Functional/Scripts/checkEnvironment.sh", + "vendor/auxmoney/opentracing-bundle-core/Tests/Functional/Scripts/setup.sh", + "vendor/auxmoney/opentracing-bundle-core/Tests/Functional/Scripts/createResetPoint.sh", + "vendor/bin/phpunit --colors=never --testsuite=functional --no-coverage", + "vendor/auxmoney/opentracing-bundle-core/Tests/Functional/Scripts/teardown.sh" + ], "phpstan": "vendor/bin/phpstan analyse --no-progress" } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 82e4438..0e78075 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,6 +20,12 @@ ./Tests/ + ./Tests/Functional + + + ./Tests/Functional/ + ./Tests/Functional/Scripts + ./Tests/Functional/TestProjectFiles