user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@yhbt.net>
To: meta@public-inbox.org
Subject: [PATCH 2/3] t/nntpd: reduce dependencies on internal API
Date: Tue, 21 Apr 2020 03:22:51 +0000	[thread overview]
Message-ID: <20200421032252.9151-3-e@yhbt.net> (raw)
In-Reply-To: <20200421032252.9151-1-e@yhbt.net>

Since the advent of run_script(), we can rely on it to simplify
our test code.  Changes like this will let us evolve the
internal API more easily while preserving stable CLI interfaces,
especially since we test the v2 path by default, now.
---
 t/nntpd.t | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/t/nntpd.t b/t/nntpd.t
index b2ef575d..2d7280a5 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -6,8 +6,6 @@ use Test::More;
 use PublicInbox::TestCommon;
 use PublicInbox::Spawn qw(which);
 require_mods(qw(DBD::SQLite));
-require PublicInbox::SearchIdx;
-require PublicInbox::Msgmap;
 require PublicInbox::InboxWritable;
 use Email::Simple;
 use IO::Socket;
@@ -79,8 +77,8 @@ EOF
 		$im->add($mime);
 		$im->done;
 		if ($version == 1) {
-			my $s = PublicInbox::SearchIdx->new($ibx, 1);
-			$s->index_sync;
+			ok(run_script(['-index', $ibx->{inboxdir}]),
+				'indexed v1');
 		}
 	}
 
@@ -254,8 +252,8 @@ Date: Fri, 02 Oct 1993 00:00:00 +0000
 		$im->add($for_leafnode);
 		$im->done;
 		if ($version == 1) {
-			my $s = PublicInbox::SearchIdx->new($ibx, 1);
-			$s->index_sync;
+			ok(run_script(['-index', $ibx->{inboxdir}]),
+				'indexed v1');
 		}
 		my $hdr = $n->head("<$long_hdr>");
 		my $expect = qr/\AMessage-ID: /i . qr/\Q<$long_hdr>\E/;

  parent reply	other threads:[~2020-04-21  3:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-21  3:22 [PATCH 0/3] t/nntpd: small fixes and cleanups Eric Wong
2020-04-21  3:22 ` [PATCH 1/3] t/nntpd: fix lsof check w/ TEST_RUN_MODE=0 Eric Wong
2020-04-21  3:22 ` Eric Wong [this message]
2020-04-21  3:22 ` [PATCH 3/3] t/nntpd: die if we can't open stderr output Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200421032252.9151-3-e@yhbt.net \
    --to=e@yhbt.net \
    --cc=meta@public-inbox.org \
    --subject='Re: [PATCH 2/3] t/nntpd: reduce dependencies on internal API' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).