diff options
author | Eric Wong <e@80x24.org> | 2024-05-05 23:35:10 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2024-05-06 06:06:09 +0000 |
commit | 34709e6f0153bd92a117f542a7bfb76e7d289d2e (patch) | |
tree | 69fdfb6579344b941e7018373ca55623519c3fe1 /t | |
parent | 7f3b57f4c1cbbb7ddfa41dde6d25276ee96d3fd4 (diff) | |
download | public-inbox-master.tar.gz |
External Xapian helper processes need to support non-standard QueryParser prefixes. The only way to do this is to specify these prefixes in every `mset' request since we have no idea if the XH worker servicing the request has initialized the extra prefixes, yet.
Diffstat (limited to 't')
-rw-r--r-- | t/www_altid.t | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/t/www_altid.t b/t/www_altid.t index de1e6ed6..7ad4a1d2 100644 --- a/t/www_altid.t +++ b/t/www_altid.t @@ -6,7 +6,7 @@ use PublicInbox::Config; use PublicInbox::Spawn qw(spawn); require_cmd('sqlite3'); require_mods(qw(DBD::SQLite HTTP::Request::Common Plack::Test URI::Escape - Plack::Builder IO::Uncompress::Gunzip)); + Plack::Builder IO::Uncompress::Gunzip Xapian)); use_ok($_) for qw(Plack::Test HTTP::Request::Common); require_ok 'PublicInbox::Msgmap'; require_ok 'PublicInbox::AltId'; @@ -14,17 +14,13 @@ require_ok 'PublicInbox::WWW'; my ($tmpdir, $for_destroy) = tmpdir(); my $aid = 'xyz'; my $cfgpath; -my $ibx = create_inbox 'test', indexlevel => 'basic', sub { +my $spec = "serial:$aid:file=blah.sqlite3"; +my $ibx = create_inbox 'test-altid', indexlevel => 'medium', + altid => [ $spec ], sub { my ($im, $ibx) = @_; - $im->add(PublicInbox::Eml->new(<<'EOF')) or BAIL_OUT; -From: a@example.com -Message-Id: <a@example.com> - -EOF - # $im->done; - my $spec = "serial:$aid:file=blah.sqlite3"; my $altid = PublicInbox::AltId->new($ibx, $spec, 1); $altid->mm_alt->mid_set(1, 'a@example.com'); + undef $altid; $cfgpath = "$ibx->{inboxdir}/cfg"; open my $fh, '>', $cfgpath or BAIL_OUT "open $cfgpath: $!"; print $fh <<EOF or BAIL_OUT $!; @@ -35,6 +31,11 @@ EOF url = http://example.com/test EOF close $fh or BAIL_OUT $!; + $im->add(PublicInbox::Eml->new(<<'EOF')) or BAIL_OUT; +From: a@example.com +Message-Id: <a@example.com> + +EOF }; $cfgpath //= "$ibx->{inboxdir}/cfg"; my $cfg = PublicInbox::Config->new($cfgpath); @@ -56,6 +57,11 @@ my $client = sub { is($mm_cmp->mid_for(1), 'a@example.com', 'sqlite3 dump valid'); $mm_cmp = undef; unlink $cmpfile or die; + + $res = $cb->(GET('/test/?q=xyz:1')); + is $res->code, 200, 'altid search hit'; + $res = $cb->(GET('/test/?q=xyz:10')); + is $res->code, 404, 'altid search miss'; }; test_psgi(sub { $www->call(@_) }, $client); SKIP: { |