Skip to content

Commit c255505

Browse files
committed
feature: add predis test
Signed-off-by: Mateusz Cholewka <mateusz@cholewka.com.pl>
1 parent 94c272a commit c255505

9 files changed

+229
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractCollectorRegistryTest;
10+
11+
/**
12+
* @requires extension redis
13+
*/
14+
class CollectorRegistryTest extends AbstractCollectorRegistryTest
15+
{
16+
public function configureAdapter(): void
17+
{
18+
$connection = new Client(['host' => REDIS_HOST]);
19+
20+
$this->adapter = Redis::fromExistingConnection($connection);
21+
$this->adapter->wipeStorage();
22+
}
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractCounterTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class CounterTest extends AbstractCounterTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST]);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractCounterTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class CounterWithPrefixTest extends AbstractCounterTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST, 'prefix' => 'prefix:']);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractGaugeTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class GaugeTest extends AbstractGaugeTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST]);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractGaugeTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class GaugeWithPrefixTest extends AbstractGaugeTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST, 'prefix' => 'prefix:']);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractHistogramTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class HistogramTest extends AbstractHistogramTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST]);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractHistogramTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class HistogramWithPrefixTest extends AbstractHistogramTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST, 'prefix' => 'prefix:']);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractSummaryTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class SummaryTest extends AbstractSummaryTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST]);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
26+
/** @test */
27+
public function it_should_observe_with_labels(): void
28+
{
29+
parent::itShouldObserveWithLabels(); // TODO: Change the autogenerated stub
30+
}
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Test\Prometheus\Predis;
6+
7+
use Predis\Client;
8+
use Prometheus\Storage\Redis;
9+
use Test\Prometheus\AbstractSummaryTest;
10+
11+
/**
12+
* See https://prometheus.io/docs/instrumenting/exposition_formats/
13+
*
14+
* @requires extension redis
15+
*/
16+
class SummaryWithPrefixTest extends AbstractSummaryTest
17+
{
18+
public function configureAdapter(): void
19+
{
20+
$connection = new Client(['host' => REDIS_HOST, 'prefix' => 'prefix:']);
21+
22+
$this->adapter = Redis::fromExistingConnection($connection);
23+
$this->adapter->wipeStorage();
24+
}
25+
}

0 commit comments

Comments
 (0)