diff options
author | Eric Wong <e@80x24.org> | 2021-09-12 07:47:12 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-12 07:48:56 +0000 |
commit | b45a1dffa647f6427d0c900fcc55753db7a1994c (patch) | |
tree | eafb5e666662bc65afd1aad33aeb203134b1efd7 /t | |
parent | 02a0f3959b2e74f7217fcdca848822e7230acd6b (diff) | |
download | public-inbox-b45a1dffa647f6427d0c900fcc55753db7a1994c.tar.gz |
Setting up and maintaining git-only mirrors of v2 inboxes is complex since multiple commands are required to clone and fetch into epochs. Unlike grokmirror, these commands do not require any configuration. Instead, they rely on existing git config files and work like "git clone --mirror" and "git fetch", respectively. Like grokmirror, they use manifest.js.gz, but only on a per-inbox basis so users won't have to clone every inbox of a large instance nor edit config files to include/exclude inboxes they're interested in.
Diffstat (limited to 't')
-rw-r--r-- | t/lei-mirror.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/t/lei-mirror.t b/t/lei-mirror.t index a61a7565..75e25b3f 100644 --- a/t/lei-mirror.t +++ b/t/lei-mirror.t @@ -46,6 +46,7 @@ test_lei({ tmpdir => $tmpdir }, sub { lei_ok('add-external', "$t1-pfx", '--mirror', "$http/pfx/t1/", \'--mirror v1 w/ PSGI prefix'); + ok(!-e "$t1-pfx/mirror.done", 'no leftover mirror.done'); my $d = "$home/404"; ok(!lei(qw(add-external --mirror), "$http/404", $d), 'mirror 404'); @@ -77,6 +78,34 @@ test_lei({ tmpdir => $tmpdir }, sub { } # for }); +SKIP: { + undef $sock; + my $d = "$tmpdir/d"; + mkdir $d or xbail "mkdir $d $!"; + my $opt = { -C => $d, 2 => \(my $err) }; + ok(!run_script([qw(-clone -q), "$http/404"], undef, $opt), '404 fails'); + ok(!-d "$d/404", 'destination not created'); + delete $opt->{2}; + + ok(run_script([qw(-clone -q -C), $d, "$http/t2"], undef, $opt), + '-clone succeeds on v2'); + ok(-d "$d/t2/git/0.git", 'epoch cloned'); + ok(-f "$d/t2/manifest.js.gz", 'manifest saved'); + ok(!-e "$d/t2/mirror.done", 'no leftover mirror.done'); + ok(run_script([qw(-fetch -q -C), "$d/t2"], undef, $opt), + '-fetch succeeds w/ manifest.js.gz'); + unlink("$d/t2/manifest.js.gz") or xbail "unlink $!"; + ok(run_script([qw(-fetch -q -C), "$d/t2"], undef, $opt), + '-fetch succeeds w/o manifest.js.gz'); + + ok(run_script([qw(-clone -q -C), $d, "$http/t1"], undef, $opt), + 'cloning v1 works'); + ok(-d "$d/t1", 'v1 cloned'); + ok(!-e "$d/t1/mirror.done", 'no leftover file'); + ok(run_script([qw(-fetch -q -C), "$d/t1"], undef, $opt), + 'fetching v1 works'); +} + ok($td->kill, 'killed -httpd'); $td->join; |