]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/www_listing.t
git: ensure ->modified returns an integer
[public-inbox.git] / t / www_listing.t
index f9d543e592aa3b2fe001596878f6d77bd9b0518c..1f2929808f54c21ab1dd73ddda4a7f600608029a 100644 (file)
@@ -96,6 +96,7 @@ SKIP: {
                $body .= $buf;
        }
        IO::Uncompress::Gunzip::gunzip(\$body => \$tmp);
+       unlike($tmp, qr/"modified":\s*"/, 'modified is an integer');
        my $manifest = $json->decode($tmp);
        ok(my $clone = $manifest->{'/alt'}, '/alt in manifest');
        is($clone->{owner}, 'lorelei', 'owner set');
@@ -111,7 +112,7 @@ SKIP: {
        is(HTTP::Date::time2str($bare->{modified}), $h{'Last-Modified'},
                'modified field and Last-Modified header match');
 
-       ok($manifest->{'/v2/0'}, 'v2 epoch appeared');
+       ok($manifest->{'/v2/git/0.git'}, 'v2 epoch appeared');
 
        skip 'skipping grok-pull integration test', 2 if !which('grok-pull');
 
@@ -130,9 +131,29 @@ mymanifest = $tmpdir/local-manifest.js.gz
 
        system(qw(grok-pull -c), "$tmpdir/repos.conf");
        is($? >> 8, 127, 'grok-pull exit code as expected');
-       for (qw(alt bare v2/0 v2/1 v2/2)) {
+       for (qw(alt bare v2/git/0.git v2/git/1.git v2/git/2.git)) {
                ok(-d "$tmpdir/mirror/$_", "grok-pull created $_");
        }
+
+       # support per-inbox manifests, handy for v2:
+       # /$INBOX/v2/manifest.js.gz
+       open $fh, '>', "$tmpdir/per-inbox.conf" or die;
+       print $fh <<"" or die;
+# You can pull from multiple grok mirrors, just create
+# a separate section for each mirror. The name can be anything.
+[v2]
+site = http://$host:$port
+manifest = http://$host:$port/v2/manifest.js.gz
+toplevel = $tmpdir/per-inbox
+mymanifest = $tmpdir/per-inbox-manifest.js.gz
+
+       close $fh or die;
+       ok(mkdir("$tmpdir/per-inbox"), 'prepare single-v2-inbox mirror');
+       system(qw(grok-pull -c), "$tmpdir/per-inbox.conf");
+       is($? >> 8, 127, 'grok-pull exit code as expected');
+       for (qw(v2/git/0.git v2/git/1.git v2/git/2.git)) {
+               ok(-d "$tmpdir/per-inbox/$_", "grok-pull created $_");
+       }
 }
 
 done_testing();