X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fconfig_limiter.t;h=57e298bab80ef4e0613f93c4d09be5dcd099016e;hb=3c39f9c942a6975245fda878e9b957d8d3367662;hp=bfea151096c9c2fe502120e0b14318247ae80ce7;hpb=2c972f3d70caf99488fff300341450e48be6ebf1;p=public-inbox.git
diff --git a/t/config_limiter.t b/t/config_limiter.t
index bfea1510..57e298ba 100644
--- a/t/config_limiter.t
+++ b/t/config_limiter.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2016 all contributors
+# Copyright (C) 2016-2019 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
@@ -6,18 +6,17 @@ use Test::More;
use PublicInbox::Config;
my $cfgpfx = "publicinbox.test";
{
- my $config = PublicInbox::Config->new({
- "$cfgpfx.address" => 'test@example.com',
- "$cfgpfx.mainrepo" => '/path/to/non/existent',
- "$cfgpfx.httpbackendmax" => 12,
- });
+ my $config = PublicInbox::Config->new(\<lookup_name('test');
my $git = $ibx->git;
my $old = "$git";
my $lim = $git->{-httpbackend_limiter};
ok($lim, 'Limiter exists');
is($lim->{max}, 12, 'limiter has expected slots');
- $git = undef;
$ibx->{git} = undef;
$git = $ibx->git;
isnt($old, "$git", 'got new Git object');
@@ -25,25 +24,23 @@ my $cfgpfx = "publicinbox.test";
}
{
- my $config = PublicInbox::Config->new({
- 'limiter.named.max' => 3,
- "$cfgpfx.address" => 'test@example.com',
- "$cfgpfx.mainrepo" => '/path/to/non/existent',
- "$cfgpfx.httpbackendmax" => 'named',
- });
+ my $config = PublicInbox::Config->new(\<lookup_name('test');
my $git = $ibx->git;
ok($git, 'got git object');
- my $old = "$git";
+ my $old = "$git"; # stringify object ref "Git(0xDEADBEEF)"
my $lim = $git->{-httpbackend_limiter};
ok($lim, 'Limiter exists');
is($lim->{max}, 3, 'limiter has expected slots');
- $git = undef;
$ibx->{git} = undef;
- PublicInbox::Inbox::weaken_task;
- $git = $ibx->git;
- isnt($old, "$git", 'got new Git object');
- is("$git->{-httpbackend_limiter}", "$lim", 'same limiter');
+ my $new = $ibx->git;
+ isnt($old, "$new", 'got new Git object');
+ is("$new->{-httpbackend_limiter}", "$lim", 'same limiter');
is($lim->{max}, 3, 'limiter has expected slots');
}