-my $im = PublicInbox::InboxWritable->new($ibx, {nproc => $nproc})->importer(1);
-for my $i (1..$ndoc) {
- $mime->header_set('Message-ID', "<m$i\@example.com>");
- ok($im->add($mime), "message $i added");
-}
-$im->done;
+my $ibx = create_inbox 'test', version => 2, indexlevel => 'medium',
+ tmpdir => "$tmpdir/testbox", nproc => $nproc, sub {
+ my ($im, $ibx) = @_;
+ my $eml = PublicInbox::Eml->new(<<'EOF');
+From: a@example.com
+To: test@example.com
+Subject: this is a subject
+Date: Fri, 02 Oct 1993 00:00:00 +0000
+
+EOF
+ for my $i (1..$ndoc) {
+ $eml->header_set('Message-ID', "<m$i\@example.com>");
+ ok($im->add($eml), "message $i added");
+ }
+ open my $fh, '>', "$ibx->{inboxdir}/empty" or BAIL_OUT "open $!";
+};
+my $env = { PI_CONFIG => "$ibx->{inboxdir}/empty" };