Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
vendor
.phpunit.result.cache
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ register_shutdown_function(function() {
})
```

## Testing
Have docker installed, and run `./test.sh`

## Instrumentation for Tracing

Since this tracer is fully compliant with the OpenTracing API 1.0, all code instrumentation should only use the API itself, as descriped in the [opentracing-php](https://github.com/opentracing/opentracing-php) documentation.
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="false">
<testsuites>
<testsuite name="jaeger-client-php">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
16 changes: 16 additions & 0 deletions test.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM php:8.0.26-alpine3.16

WORKDIR /bin

# install the sockets php extension
RUN docker-php-ext-install sockets

# install composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php && \
php -r "unlink('composer-setup.php');"

WORKDIR /app

ENTRYPOINT ["php", "/bin/composer.phar"]
25 changes: 25 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

set -e # Fail fast

LOCAL_DIR=$(cd "$(dirname "$BASH_SOURCE")" && pwd)
BUILDER_IMAGE=jaeger-client-php-tester

if [[ "$(docker images -q $BUILDER_IMAGE 2> /dev/null)" == "" ]]; then
echo "--Creating builder image"
docker build --no-cache --file test.Dockerfile --tag $BUILDER_IMAGE .
fi

if [ ! -d "$LOCAL_DIR/vendor" ]; then
echo "--No vendor directory detected. Running a composer install"
docker run --rm \
--volume $LOCAL_DIR:/app \
$BUILDER_IMAGE \
install
fi

echo "--Running tests"
docker run --rm \
--volume $LOCAL_DIR:/app \
$BUILDER_IMAGE \
test