Mercurial > prosody-modules
annotate mod_lib_ldap/dev/t/00-login.t @ 5668:ecfd7aece33b
mod_measure_modules: Report module statuses via OpenMetrics
Someone in the chat asked about a health check endpoint, which reminded
me of mod_http_status, which provides access to module statuses with
full details. After that, this idea came about, which seems natural.
As noted in the README, it could be used to monitor that critical
modules are in fact loaded correctly.
As more modules use the status API, the more useful this module and
mod_http_status becomes.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 06 Oct 2023 18:34:39 +0200 |
parents | 512e31cd8b70 |
children |
rev | line source |
---|---|
809 | 1 use strict; |
2 use warnings; | |
3 use lib 't'; | |
4 | |
5 use TestConnection; | |
6 use Test::More; | |
7 | |
8 my @users = ( | |
9 'one', | |
10 'two', | |
11 'three', | |
12 'four', | |
13 'five', | |
866 | 14 'six', |
809 | 15 ); |
16 | |
874 | 17 plan tests => scalar(@users) + 3; |
809 | 18 |
19 foreach my $username (@users) { | |
20 my $conn = TestConnection->new($username); | |
21 | |
22 $conn->reg_cb(session_ready => sub { | |
23 $conn->cond->send; | |
24 }); | |
25 | |
26 my $error = $conn->cond->recv; | |
867
a93cb608db2c
Print the username if a test login fails
Rob Hoelz <rob@hoelz.ro>
parents:
866
diff
changeset
|
27 ok(! $error) or diag("$username login failed: $error"); |
809 | 28 } |
29 | |
30 do { | |
31 my $conn = TestConnection->new('one', password => '23451'); | |
32 | |
33 $conn->reg_cb(session_ready => sub { | |
34 $conn->cond->send; | |
35 }); | |
36 | |
37 my $error = $conn->cond->recv; | |
38 ok($error); | |
39 }; | |
40 | |
41 do { | |
876
512e31cd8b70
Fix login failure test to use a non-existent user
Rob Hoelz <rob@hoelz.ro>
parents:
874
diff
changeset
|
42 my $conn = TestConnection->new('invalid', password => '12345'); |
809 | 43 |
44 $conn->reg_cb(session_ready => sub { | |
45 $conn->cond->send; | |
46 }); | |
47 | |
48 my $error = $conn->cond->recv; | |
49 ok($error); | |
50 }; | |
874 | 51 |
52 do { | |
53 my $conn = TestConnection->new('seven', password => '1234567'); | |
54 | |
55 $conn->reg_cb(session_ready => sub { | |
56 $conn->cond->send; | |
57 }); | |
58 | |
59 my $error = $conn->cond->recv; | |
60 ok($error); | |
61 }; |