From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id BDA3D1FC9B for ; Fri, 27 Nov 2020 09:52:55 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 09/12] t/extsearch: show a more realistic case Date: Fri, 27 Nov 2020 09:52:51 +0000 Message-Id: <20201127095254.21624-10-e@80x24.org> In-Reply-To: <20201127095254.21624-1-e@80x24.org> References: <20201127095254.21624-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Different messages to different public Inboxes are likely to have different List-IDs, so show that we can deduplicate based on content (but per-mailing-list trailers need to go through a PublicInbox::Filter::* or be disabled by mailing list admins). --- t/extsearch.t | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/t/extsearch.t b/t/extsearch.t index 85cdf74a..778ba32d 100644 --- a/t/extsearch.t +++ b/t/extsearch.t @@ -25,14 +25,28 @@ my $v1addr = 'v1test@example.com'; ok(run_script([qw(-init -V2 v2test --newsgroup v2.example), "$home/v2test", 'http://example.com/v2test', $v2addr ]), 'v2test init'); my $env = { ORIGINAL_RECIPIENT => $v2addr }; -open($fh, '<', 't/utf8.eml') or BAIL_OUT("open t/utf8.eml: $!"); +my $eml = eml_load('t/utf8.eml'); + +$eml->header_set('List-Id', ''); +open($fh, '+>', undef) or BAIL_OUT $!; +$fh->autoflush(1); +print $fh $eml->as_string or BAIL_OUT $!; +seek($fh, 0, SEEK_SET) or BAIL_OUT $!; + run_script(['-mda', '--no-precheck'], $env, { 0 => $fh }) or BAIL_OUT '-mda'; ok(run_script([qw(-init -V1 v1test), "$home/v1test", 'http://example.com/v1test', $v1addr ]), 'v1test init'); -$env = { ORIGINAL_RECIPIENT => $v1addr }; + +$eml->header_set('List-Id', ''); seek($fh, 0, SEEK_SET) or BAIL_OUT $!; +truncate($fh, 0) or BAIL_OUT $!; +print $fh $eml->as_string or BAIL_OUT $!; +seek($fh, 0, SEEK_SET) or BAIL_OUT $!; + +$env = { ORIGINAL_RECIPIENT => $v1addr }; run_script(['-mda', '--no-precheck'], $env, { 0 => $fh }) or BAIL_OUT '-mda'; + run_script(['-index', "$home/v1test"]) or BAIL_OUT "index $?"; ok(run_script([qw(-extindex --all), "$home/extindex"]), 'extindex init');