2 # Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use strict; use v5.10.1; use PublicInbox::TestCommon;
5 my $sock = tcp_server();
6 my ($tmpdir, $for_destroy) = tmpdir();
7 my $http = 'http://'.$sock->sockhost.':'.$sock->sockport.'/';
8 my ($ro_home, $cfg_path) = setup_public_inboxes;
9 my $cmd = [ qw(-httpd -W0), "--stdout=$tmpdir/out", "--stderr=$tmpdir/err" ];
10 my $td = start_script($cmd, { PI_CONFIG => $cfg_path }, { 3 => $sock });
11 test_lei({ tmpdir => $tmpdir }, sub {
12 my $home = $ENV{HOME};
13 my $t1 = "$home/t1-mirror";
14 ok($lei->('add-external', $t1, '--mirror', "$http/t1/"), '--mirror v1');
15 ok(-f "$t1/public-inbox/msgmap.sqlite3", 't1-mirror indexed');
16 my $t2 = "$home/t2-mirror";
17 ok($lei->('add-external', $t2, '--mirror', "$http/t2/"), '--mirror v2');
18 ok(-f "$t2/msgmap.sqlite3", 't2-mirror indexed');
21 ok($td->kill, 'killed -httpd');