]> Sergey Matveev's repositories - public-inbox.git/blob - t/thread-all.t
t/thread-all.t: modernize test to support modern inboxes
[public-inbox.git] / t / thread-all.t
1 # Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 #
4 # real-world testing of search threading
5 use strict;
6 use warnings;
7 use Test::More;
8 use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
9 use PublicInbox::Inbox;
10 my $pi_dir = $ENV{GIANT_PI_DIR};
11 plan skip_all => "GIANT_PI_DIR not defined for $0" unless $pi_dir;
12 my $ibx = PublicInbox::Inbox->new({ mainrepo => $pi_dir });
13 my $srch = $ibx->search;
14 plan skip_all => "$pi_dir not configured for search $0" unless $srch;
15
16 require PublicInbox::View;
17 require PublicInbox::SearchThread;
18
19 my $t0 = clock_gettime(CLOCK_MONOTONIC);
20 my $elapsed;
21 my $msgs = $srch->{over_ro}->recent({limit => 200000});
22 my $n = scalar(@$msgs);
23 ok($n, 'got some messages');
24 $elapsed = clock_gettime(CLOCK_MONOTONIC) - $t0;
25 diag "enquire: $elapsed for $n";
26
27 $t0 = clock_gettime(CLOCK_MONOTONIC);
28 PublicInbox::View::thread_results({-inbox => $ibx}, $msgs);
29 $elapsed = clock_gettime(CLOCK_MONOTONIC) - $t0;
30 diag "thread_results $elapsed";
31
32 done_testing();