]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/perf-nntpd.t
mda: hoist out mda_filter_adjust
[public-inbox.git] / t / perf-nntpd.t
index 3ca1ce335768454dc4ea2f22f4d99912833474ee..7abf2249ef32386ad7677fff22272b2e417d216e 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2018 all contributors <meta@public-inbox.org>
+# Copyright (C) 2018-2019 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -27,7 +27,7 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) {
        $host_port .= ":119" unless index($host_port, ':') > 0;
 } else {
        $group = 'inbox.test.perf.nntpd';
-       my $ibx = { mainrepo => $pi_dir, newsgroup => $group };
+       my $ibx = { inboxdir => $pi_dir, newsgroup => $group };
        $ibx = PublicInbox::Inbox->new($ibx);
        my $nntpd = 'blib/script/public-inbox-nntpd';
        my $tmpdir = tempdir('perf-nntpd-XXXXXX', TMPDIR => 1, CLEANUP => 1);
@@ -38,20 +38,13 @@ if (($ENV{NNTP_TEST_URL} || '') =~ m!\Anntp://([^/]+)/([^/]+)\z!) {
                print $fh <<"" or die "print $pi_config: $!";
 [publicinbox "test"]
        newsgroup = $group
-       mainrepo = $pi_dir
+       inboxdir = $pi_dir
        address = test\@example.com
 
                close $fh or die "close($pi_config): $!";
        }
 
-       %opts = (
-               LocalAddr => '127.0.0.1',
-               ReuseAddr => 1,
-               Proto => 'tcp',
-               Listen => 1024,
-       );
-       my $sock = IO::Socket::INET->new(%opts);
-
+       my $sock = tcp_server();
        ok($sock, 'sock created');
        my $cmd = [ $nntpd, '-W0' ];
        $pid = spawn_listener({ PI_CONFIG => $pi_config }, $cmd, [$sock]);
@@ -108,7 +101,7 @@ diag "XHDR From ". timestr($t) . " for $n";
 my $date = $ENV{NEWNEWS_DATE};
 unless ($date) {
        my (undef, undef, undef, $d, $m, $y) = gmtime(time - 30 * 86400);
-       $date = sprintf('%04u%02u%02u', $y + 1900, $m, $d);
+       $date = sprintf('%04u%02u%02u', $y + 1900, $m + 1, $d);
        diag "NEWNEWS_DATE undefined, using $date";
 }
 $t = timeit(1, sub {