File: 16-labels-add.t

package info (click to toggle)
libprometheus-tiny-perl 0.011-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 180 kB
  • sloc: perl: 746; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (3)
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
#!perl

use warnings;
use strict;

use Test::More;

use Prometheus::Tiny;

{
  my $p = Prometheus::Tiny->new;
  $p->add('some_metric', 5, { some_label => 'aaa' });
  is $p->format, <<EOF, 'single metric with label adds correctly';
some_metric{some_label="aaa"} 5
EOF
}

{
  my $p = Prometheus::Tiny->new;
  $p->inc('some_metric', { some_label => "aaa" });
  is $p->format, <<EOF, 'single metric with label increments correctly';
some_metric{some_label="aaa"} 1
EOF
}

{
  my $p = Prometheus::Tiny->new;
  $p->dec('some_metric', { some_label => "aaa" });
  is $p->format, <<EOF, 'single metric with label decrements correctly';
some_metric{some_label="aaa"} -1
EOF
}

done_testing;