1 # Copyright (C) 2016-2020 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
6 use PublicInbox::Config;
7 my $cfgpfx = "publicinbox.test";
9 my $config = PublicInbox::Config->new(\<<EOF);
10 $cfgpfx.address=test\@example.com
11 $cfgpfx.inboxdir=/path/to/non/existent
12 $cfgpfx.httpbackendmax=12
14 my $ibx = $config->lookup_name('test');
17 my $lim = $git->{-httpbackend_limiter};
18 ok($lim, 'Limiter exists');
19 is($lim->{max}, 12, 'limiter has expected slots');
22 isnt($old, "$git", 'got new Git object');
23 is("$git->{-httpbackend_limiter}", "$lim", 'same limiter');
27 my $config = PublicInbox::Config->new(\<<EOF);
28 publicinboxlimiter.named.max=3
29 $cfgpfx.address=test\@example.com
30 $cfgpfx.inboxdir=/path/to/non/existent
31 $cfgpfx.httpbackendmax=named
33 my $ibx = $config->lookup_name('test');
35 ok($git, 'got git object');
36 my $old = "$git"; # stringify object ref "Git(0xDEADBEEF)"
37 my $lim = $git->{-httpbackend_limiter};
38 ok($lim, 'Limiter exists');
39 is($lim->{max}, 3, 'limiter has expected slots');
42 isnt($old, "$new", 'got new Git object');
43 is("$new->{-httpbackend_limiter}", "$lim", 'same limiter');
44 is($lim->{max}, 3, 'limiter has expected slots');