about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2017-01-08 04:25:51 +0000
committerEric Wong <e@80x24.org>2017-01-08 04:25:51 +0000
commit98a24a7404181006b2a102e9ae5e3a8938fdc172 (patch)
tree287458df7979453cef60dfbdfbc094794300c09a /t
parent68f83ca5236078128a0ccf47a1e54bd955777120 (diff)
parentf1a38b18d9a46531e18143a7cd4c7a66fc89adbc (diff)
downloadpublic-inbox-98a24a7404181006b2a102e9ae5e3a8938fdc172.tar.gz
* origin/master:
  inbox: properly register cleanup timer for git processes
  search: remove subject_summary
  searchmsg: favor direct hash access over accessor methods
  remove incorrect comment about strftime + locales
  config: allow per-inbox nntpserver
  inbox: eliminate weaken usage entirely
  inbox: describe the full key name
  config: remove unused get() method
  config: always use namespaced "publicinboxlimiter"
  qspawn: prepare to support runtime reloading of Limiter
  http: remove weaken usage, reduce anonsub capture scope
  httpd/async: remove weaken usage
  http: fix spelling error
  watch: watchspam affects all configured inboxes
  doc: minor updates to design notes
Diffstat (limited to 't')
-rw-r--r--t/config.t25
-rw-r--r--t/config_limiter.t11
-rw-r--r--t/search.t17
3 files changed, 28 insertions, 25 deletions
diff --git a/t/config.t b/t/config.t
index 7271351b..3ba61119 100644
--- a/t/config.t
+++ b/t/config.t
@@ -31,7 +31,8 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1);
                 -primary_address => 'meta@public-inbox.org',
                 'name' => 'meta',
                 feedmax => 25,
-                -pi_config => $cfg,
+                -httpbackend_limiter => undef,
+                nntpserver => undef,
         }, "lookup matches expected output");
 
         is($cfg->lookup('blah@example.com'), undef,
@@ -48,7 +49,8 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1);
                 'name' => 'test',
                 feedmax => 25,
                 'url' => 'http://example.com/test',
-                -pi_config => $cfg,
+                -httpbackend_limiter => undef,
+                nntpserver => undef,
         }, "lookup matches expected output for test");
 }
 
@@ -65,4 +67,23 @@ my $tmpdir = tempdir('pi-config-XXXXXX', TMPDIR => 1, CLEANUP => 1);
         is_deeply($ibx->{altid}, [ @altid ]);
 }
 
+{
+        my $pfx = "publicinbox.test";
+        my %h = (
+                "$pfx.address" => 'test@example.com',
+                "$pfx.mainrepo" => '/path/to/non/existent',
+                "publicinbox.nntpserver" => 'news.example.com',
+        );
+        my %tmp = %h;
+        my $cfg = PublicInbox::Config->new(\%tmp);
+        my $ibx = $cfg->lookup_name('test');
+        is($ibx->{nntpserver}, 'news.example.com', 'global NNTP server');
+
+        delete $h{'publicinbox.nntpserver'};
+        $h{"$pfx.nntpserver"} = 'news.alt.example.com';
+        $cfg = PublicInbox::Config->new(\%h);
+        $ibx = $cfg->lookup_name('test');
+        is($ibx->{nntpserver}, 'news.alt.example.com','per-inbox NNTP server');
+}
+
 done_testing();
diff --git a/t/config_limiter.t b/t/config_limiter.t
index 3c7ec557..f0b65281 100644
--- a/t/config_limiter.t
+++ b/t/config_limiter.t
@@ -25,7 +25,7 @@ my $cfgpfx = "publicinbox.test";
 
 {
         my $config = PublicInbox::Config->new({
-                'limiter.named.max' => 3,
+                'publicinboxlimiter.named.max' => 3,
                 "$cfgpfx.address" => 'test@example.com',
                 "$cfgpfx.mainrepo" => '/path/to/non/existent',
                 "$cfgpfx.httpbackendmax" => 'named',
@@ -37,12 +37,11 @@ my $cfgpfx = "publicinbox.test";
         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');
+        PublicInbox::Inbox::cleanup_task;
+        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');
 }
 
diff --git a/t/search.t b/t/search.t
index c16811d8..c9c4e346 100644
--- a/t/search.t
+++ b/t/search.t
@@ -15,23 +15,6 @@ is(0, system(qw(git init -q --bare), $git_dir), "git init (main)");
 eval { PublicInbox::Search->new($git_dir) };
 ok($@, "exception raised on non-existent DB");
 
-{
-        my $orig = "FOO " x 30;
-        my $summ = PublicInbox::Search::subject_summary($orig);
-
-        $summ = length($summ);
-        $orig = length($orig);
-        ok($summ < $orig && $summ > 0, "summary shortened ($orig => $summ)");
-
-        $orig = "FOO" x 30;
-        $summ = PublicInbox::Search::subject_summary($orig);
-
-        $summ = length($summ);
-        $orig = length($orig);
-        ok($summ < $orig && $summ > 0,
-           "summary shortened but not empty: $summ");
-}
-
 my $rw = PublicInbox::SearchIdx->new($git_dir, 1);
 $rw->_xdb_acquire;
 $rw->_xdb_release;