File: 23collector.t

package info (click to toggle)
libnet-prometheus-perl 0.14-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 304 kB
  • sloc: perl: 1,847; makefile: 8
file content (36 lines) | stat: -rw-r--r-- 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

use v5.14;
use warnings;

use Test2::V0;

use Net::Prometheus;

my $client = Net::Prometheus->new(
   disable_process_collector => 1,
   disable_perl_collector    => 1,
);

$client->register( CustomCollector->new );

my $collector_options;

$client->render( { custom_collector_option => 123 } );

is( $collector_options, { custom_collector_option => 123 },
   'CustomCollector->collect invoked with options' );

done_testing;

package CustomCollector;

sub new { return bless {}, shift }

sub collect
{
   shift;
   ( $collector_options ) = @_;

   return ();
}