File: 900-regression.t

package info (click to toggle)
libprometheus-tiny-shared-perl 0.027-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 200 kB
  • sloc: perl: 830; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 721 bytes parent folder | download | duplicates (2)
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
#!perl

use warnings;
use strict;

use Test::More;

use Prometheus::Tiny::Shared;

# 0.003 introduced timestamp supported, stored in $meta{timestamp}, which
# tramples the metadata for a declared metric named for keys under the meta namespace
{
  my $p = Prometheus::Tiny::Shared->new;
  $p->declare('help', help => 'my help metric', type => 'gauge');
  $p->set('help', 1234);
  is $p->format, <<EOF, 'declared metric named "help" formatted correctly';
# HELP help my help metric
# TYPE help gauge
help 1234
EOF

  $p->set('help', 2345, {}, 3456);
  is $p->format, <<EOF, 'declared metric named "help" with timestamp formatted correctly';
# HELP help my help metric
# TYPE help gauge
help 2345 3456
EOF
}

done_testing;