-use warnings;
-use Test::More;
-use File::Temp qw/tempdir/;
-foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
- eval "require $mod";
- plan skip_all => "$mod missing for altid_v2.t" if $@;
-}
-
-use_ok 'PublicInbox::V2Writable';
-use_ok 'PublicInbox::Inbox';
-my $tmpdir = tempdir('pi-altidv2-XXXXXX', TMPDIR => 1, CLEANUP => 1);
-my $mainrepo = "$tmpdir/inbox";
-my $full = "$tmpdir/inbox/another-nntp.sqlite3";
-my $altid = [ 'serial:gmane:file=another-nntp.sqlite3' ];
-
-{
- ok(mkdir($mainrepo), 'created repo for msgmap');
- my $mm = PublicInbox::Msgmap->new_file($full, 1);
- is($mm->mid_set(1234, 'a@example.com'), 1, 'mid_set once OK');
+use v5.10.1;
+use PublicInbox::TestCommon;
+use PublicInbox::Eml;
+require_git(2.6);
+require_mods(qw(DBD::SQLite Search::Xapian));
+require PublicInbox::Msgmap;
+my $another = 'another-nntp.sqlite3';
+my $altid = [ "serial:gmane:file=$another" ];
+my $ibx = create_inbox 'v2', version => 2, indexlevel => 'medium',
+ altid => $altid, sub {
+ my ($im, $ibx) = @_;
+ my $mm = PublicInbox::Msgmap->new_file("$ibx->{inboxdir}/$another", 2);
+ $mm->mid_set(1234, 'a@example.com') == 1 or BAIL_OUT 'mid_set once';