]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/v1reindex.t
tests: move giant inbox/git dependent tests to xt/
[public-inbox.git] / t / v1reindex.t
index d14a117d3663099688e594226ae66a051fcd2d26..c0e21a56b6ce7a8aca36ffbf12e6d9b5eaa7b390 100644 (file)
@@ -5,7 +5,6 @@ use warnings;
 use Test::More;
 use PublicInbox::MIME;
 use PublicInbox::ContentId qw(content_digest);
-use File::Temp qw/tempdir/;
 use File::Path qw(remove_tree);
 require './t/common.perl';
 require_git(2.6);
@@ -16,10 +15,10 @@ foreach my $mod (qw(DBD::SQLite Search::Xapian)) {
 }
 use_ok 'PublicInbox::SearchIdx';
 use_ok 'PublicInbox::Import';
-my $mainrepo = tempdir('pi-v1reindex-XXXXXX', TMPDIR => 1, CLEANUP => 1);
-is(system(qw(git init -q --bare), $mainrepo), 0);
+my ($inboxdir, $for_destroy) = tmpdir();
+is(system(qw(git init -q --bare), $inboxdir), 0);
 my $ibx_config = {
-       mainrepo => $mainrepo,
+       inboxdir => $inboxdir,
        name => 'test-v1reindex',
        -primary_address => 'test@example.com',
        indexlevel => 'full',
@@ -96,7 +95,7 @@ my ($mark1, $mark2, $mark3, $mark4);
        is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
 }
 
-my $xap = "$mainrepo/public-inbox/xapian".PublicInbox::Search::SCHEMA_VERSION();
+my $xap = "$inboxdir/public-inbox/xapian".PublicInbox::Search::SCHEMA_VERSION();
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed');
 {
@@ -118,7 +117,7 @@ ok(!-d $xap, 'Xapian directories removed');
        is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
 }
 
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {
@@ -141,7 +140,7 @@ ok(!-d $xap, 'Xapian directories removed again');
        is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
 }
 
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {
@@ -164,7 +163,7 @@ ok(!-d $xap, 'Xapian directories removed again');
        is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
 }
 
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {
@@ -190,7 +189,7 @@ ok(!-d $xap, 'Xapian directories removed again');
        is_deeply($ibx->mm->msg_range(\$min, $max), $msgmap, 'msgmap unchanged');
 }
 
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {
@@ -239,7 +238,7 @@ ok(!-d $xap, 'Xapian directories removed again');
 }
 
 # An incremental indexing test
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {
@@ -349,7 +348,7 @@ ok(!-d $xap, 'Xapian directories removed again');
 
 
 # Another incremental indexing test
-ok(unlink "$mainrepo/public-inbox/msgmap.sqlite3", 'remove msgmap');
+ok(unlink "$inboxdir/public-inbox/msgmap.sqlite3", 'remove msgmap');
 remove_tree($xap);
 ok(!-d $xap, 'Xapian directories removed again');
 {