File: 30-psgi.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 (24 lines) | stat: -rw-r--r-- 481 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
#!perl

use warnings;
use strict;

use Test::More;
use Plack::Test;
use HTTP::Request::Common;

use Prometheus::Tiny;

my $p = Prometheus::Tiny->new;
$p->declare('some_metric', help => 'My great metric', type => 'counter');
$p->set('some_metric', 5);

my $t = Plack::Test->create($p->psgi);
my $res = $t->request(GET '/');
is $res->content, <<EOF, 'psgi app formats metrics correctly';
# HELP some_metric My great metric
# TYPE some_metric counter
some_metric 5
EOF

done_testing;