Skip to content

Commit a3c7a3e

Browse files
committed
tests: add config for blackbox test
Signed-off-by: Mateusz Cholewka <[email protected]>
1 parent f0dbbb9 commit a3c7a3e

File tree

8 files changed

+16
-2
lines changed

8 files changed

+16
-2
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
},
3232
"suggest": {
3333
"ext-redis": "Required if using Redis.",
34+
"predis/predis": "Required if using Predis.",
3435
"ext-apc": "Required if using APCu.",
3536
"ext-pdo": "Required if using PDO.",
3637
"promphp/prometheus_push_gateway_php": "An easy client for using Prometheus PushGateway.",

examples/flush_adapter.php

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
define('REDIS_HOST', $_SERVER['REDIS_HOST'] ?? '127.0.0.1');
1111

1212
$adapter = new Prometheus\Storage\Redis(['host' => REDIS_HOST]);
13+
} elseif ($adapterName === 'predis') {
14+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1315
} elseif ($adapterName === 'apc') {
1416
$adapter = new Prometheus\Storage\APC();
1517
} elseif ($adapterName === 'apcng') {
@@ -18,4 +20,6 @@
1820
$adapter = new Prometheus\Storage\InMemory();
1921
}
2022

23+
24+
2125
$adapter->wipeStorage();

examples/metrics.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
if ($adapter === 'redis') {
1212
Redis::setDefaultOptions(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1313
$adapter = new Prometheus\Storage\Redis();
14+
} elseif ($adapter === 'predis') {
15+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1416
} elseif ($adapter === 'apc') {
1517
$adapter = new Prometheus\Storage\APC();
1618
} elseif ($adapter === 'apcng') {

examples/some_counter.php

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
if ($adapter === 'redis') {
1111
Redis::setDefaultOptions(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1212
$adapter = new Prometheus\Storage\Redis();
13+
} elseif ($adapter === 'predis') {
14+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1315
} elseif ($adapter === 'apc') {
1416
$adapter = new Prometheus\Storage\APC();
1517
} elseif ($adapter === 'apcng') {

examples/some_gauge.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
use Prometheus\CollectorRegistry;
66
use Prometheus\Storage\Redis;
77

8-
98
error_log('c=' . $_GET['c']);
109

1110
$adapter = $_GET['adapter'];
1211

1312
if ($adapter === 'redis') {
1413
Redis::setDefaultOptions(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1514
$adapter = new Prometheus\Storage\Redis();
15+
} elseif ($adapter === 'predis') {
16+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1617
} elseif ($adapter === 'apc') {
1718
$adapter = new Prometheus\Storage\APC();
1819
} elseif ($adapter === 'apcng') {

examples/some_histogram.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
if ($adapter === 'redis') {
1313
Redis::setDefaultOptions(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1414
$adapter = new Prometheus\Storage\Redis();
15+
} elseif ($adapter === 'predis') {
16+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1517
} elseif ($adapter === 'apc') {
1618
$adapter = new Prometheus\Storage\APC();
1719
} elseif ($adapter === 'apcng') {

examples/some_summary.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
if ($adapter === 'redis') {
1313
Redis::setDefaultOptions(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1414
$adapter = new Prometheus\Storage\Redis();
15+
} elseif ($adapter === 'predis') {
16+
$adapter = new Prometheus\Storage\Predis(['host' => $_SERVER['REDIS_HOST'] ?? '127.0.0.1']);
1517
} elseif ($adapter === 'apc') {
1618
$adapter = new Prometheus\Storage\APC();
1719
} elseif ($adapter === 'apcng') {

src/Prometheus/Storage/AbstractRedis.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function wipeStorage(): void
6767
<<<'LUA'
6868
redis.replicate_commands()
6969
local cursor = "0"
70-
repeat
70+
repeat
7171
local results = redis.call('SCAN', cursor, 'MATCH', ARGV[1])
7272
cursor = results[1]
7373
for _, key in ipairs(results[2]) do

0 commit comments

Comments
 (0)