Jimdo / prometheus_client_php

Prometheus instrumentation library for PHP applications
https://prometheus.io/docs/concepts/metric_types/
Apache License 2.0
281 stars 213 forks source link

Php tests failing right after cloning fresh #83

Closed aniket-z closed 6 years ago

aniket-z commented 6 years ago

I cloned the repository, did "docker-compose up" in one terminal (waited for all images to build and it to start listening), and then ran "docker-compose run phpunit env ADAPTER=redis vendor/bin/phpunit tests/Test/" in another terminal.

However, many tests failed giving
Fatal error: Uncaught exception 'RedisException' with message 'Redis server went away' in /var/www/html/src/Prometheus/Storage/Redis.php:103

When I open another terminal, run redis-cli, followed by PING, I get PONG as a reply suggesting that redis server is running on local host, and thus I do not understand why tests are failing.

Operating system: OSX 10.13.4

Thanks in advance!

aniket-z commented 6 years ago

Nevermind. Solved. Just had to increase redis timeout in Prometheus\Storage\Redis.php.

aniket-z commented 6 years ago

Also, BlackBoxPushGatewayTest uses APC, but that may not be installed. Replace that with Redis to make all tests pass.

Also, in BlackBoxPushGatewayTest you would need to write pushgateway URL before running all tests. Current default Url is pushgateway:9091. Change it, or better comment out the whole function pushGatewayShouldWork().