diff options
author | Eric Wong <e@80x24.org> | 2021-03-28 09:01:22 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-03-28 23:01:37 +0000 |
commit | 7d3a5e7e0edf0c3aef219d0e03af905f956cf671 (patch) | |
tree | d1e9269999e8b905cff64dd111351802026eb328 /t | |
parent | 8e23948182a82b5037bc9a5ffb7e42a862119644 (diff) | |
download | public-inbox-7d3a5e7e0edf0c3aef219d0e03af905f956cf671.tar.gz |
Introduce a new LeiRemote wrapper to provide an internal API which SolverGit expects. This lets us use HTTP/HTTPS endpoints to reconstruct blobs off patches as we would with local endpoints, just more slowly...
Diffstat (limited to 't')
-rw-r--r-- | t/solver_git.t | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/t/solver_git.t b/t/solver_git.t index 6d4b93c7..2d803d47 100644 --- a/t/solver_git.t +++ b/t/solver_git.t @@ -7,7 +7,7 @@ use PublicInbox::TestCommon; use Cwd qw(abs_path); require_git(2.6); use Digest::SHA qw(sha1_hex); -use PublicInbox::Spawn qw(popen_rd); +use PublicInbox::Spawn qw(popen_rd which); require_mods(qw(DBD::SQLite Search::Xapian Plack::Util)); my $git_dir = xqx([qw(git rev-parse --git-dir)], undef, {2 => \(my $null)}); $? == 0 or plan skip_all => "$0 must be run from a git working tree"; @@ -227,8 +227,20 @@ EOF my $cmd = [ qw(-httpd -W0), "--stdout=$out", "--stderr=$err" ]; my $td = start_script($cmd, $env, { 3 => $sock }); my ($h, $p) = tcp_host_port($sock); - local $ENV{PLACK_TEST_EXTERNALSERVER_URI} = "http://$h:$p"; + my $url = "http://$h:$p"; + local $ENV{PLACK_TEST_EXTERNALSERVER_URI} = $url; Plack::Test::ExternalServer::test_psgi(client => $client); + skip 'no curl', 1 unless which('curl'); + + mkdir "$tmpdir/ext" // xbail "mkdir $!"; + test_lei({tmpdir => "$tmpdir/ext"}, sub { + my $rurl = "$url/$name"; + lei_ok(qw(blob --no-mail 69df7d5 -I), $rurl); + is(sha1_hex("blob ".length($lei_out)."\0".$lei_out), + $expect, 'blob contents output'); + ok(!lei(qw(blob -I), $rurl, $non_existent), + 'non-existent blob fails'); + }); } } |