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 F2DDE1FC9E for ; Mon, 15 Mar 2021 11:58:29 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 15/35] t/psgi_mount: switch to create_inbox Date: Mon, 15 Mar 2021 12:58:06 +0100 Message-Id: <20210315115826.17591-16-e@80x24.org> In-Reply-To: <20210315115826.17591-1-e@80x24.org> References: <20210315115826.17591-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: A few dozen more milliseconds saved. --- t/psgi_mount.t | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/t/psgi_mount.t b/t/psgi_mount.t index 5836e9ce..e9547c15 100644 --- a/t/psgi_mount.t +++ b/t/psgi_mount.t @@ -1,44 +1,36 @@ +#!perl -w # Copyright (C) 2016-2021 all contributors # License: AGPL-3.0+ use strict; -use warnings; -use Test::More; +use v5.10.1; use PublicInbox::Eml; use PublicInbox::TestCommon; +use PublicInbox::Config; my ($tmpdir, $for_destroy) = tmpdir(); -my $maindir = "$tmpdir/main.git"; -my $addr = 'test-public@example.com'; +my $v1dir = "$tmpdir/v1.git"; my $cfgpfx = "publicinbox.test"; my @mods = qw(HTTP::Request::Common Plack::Test URI::Escape Plack::Builder Plack::App::URLMap); require_mods(@mods); use_ok $_ foreach @mods; use_ok 'PublicInbox::WWW'; -use PublicInbox::Import; -use PublicInbox::Git; -use PublicInbox::Config; -my $cfg = PublicInbox::Config->new(\<new($maindir); -my $im = PublicInbox::Import->new($git, 'test', $addr); -$im->init_bare; -{ - my $mime = PublicInbox::Eml->new(< $v1dir, sub { + my ($im, $ibx) = @_; + $im->add(PublicInbox::Eml->new(< To: You -Cc: $addr +Cc: $ibx->{-primary_address} Message-Id: Subject: hihi Date: Thu, 01 Jan 1970 00:00:00 +0000 zzzzzz EOF - $im->add($mime); - $im->done; -} - +}; +my $cfg = PublicInbox::Config->new(\<{-primary_address} +$cfgpfx.inboxdir=$v1dir +EOF my $www = PublicInbox::WWW->new($cfg); my $app = builder(sub { enable('Head'); @@ -83,7 +75,6 @@ test_psgi($app, sub { SKIP: { require_mods(qw(DBD::SQLite Search::Xapian IO::Uncompress::Gunzip), 3); - my $ibx = $cfg->lookup_name('test'); require_ok 'PublicInbox::SearchIdx'; PublicInbox::SearchIdx->new($ibx, 1)->index_sync; test_psgi($app, sub {