* [PATCH 0/3] some test coverage improvements
@ 2019-12-26 6:48 Eric Wong
2019-12-26 6:48 ` [PATCH 1/3] t/www_listing: quiet down stderr in -httpd Eric Wong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2019-12-26 6:48 UTC (permalink / raw)
To: meta
These were based on some bugs found by my patch series to
eliminate per-request closures from the WWW code:
https://public-inbox.org/meta/20191225075104.22184-1-e@80x24.org/
Fixes coming for to those...
Eric Wong (3):
t/www_listing: quiet down stderr in -httpd
t/www_listing: test "all" HTML listing
t/solver_git: test with -httpd, too
t/solver_git.t | 42 +++++++++++++++++++++++++++++++-----------
t/www_listing.t | 8 +++++++-
2 files changed, 38 insertions(+), 12 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] t/www_listing: quiet down stderr in -httpd
2019-12-26 6:48 [PATCH 0/3] some test coverage improvements Eric Wong
@ 2019-12-26 6:48 ` Eric Wong
2019-12-26 6:48 ` [PATCH 2/3] t/www_listing: test "all" HTML listing Eric Wong
2019-12-26 6:48 ` [PATCH 3/3] t/solver_git: test with -httpd, too Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-12-26 6:48 UTC (permalink / raw)
To: meta
We need to init all.git for the v2 repo test to ensure
`git --git-dir=v2/all.git rev-parse --git-path objects/info/alternates`
doesn't warn or fail and clutter stderr. This is noticeable
when setting TAIL="tail -F" in env before running this test.
---
t/www_listing.t | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/www_listing.t b/t/www_listing.t
index 4fcb43ea..2ff053de 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -72,6 +72,7 @@ SKIP: {
my @clone = qw(git clone -q -s --bare);
is(system(@clone, $bare->{git_dir}, $alt), 0, 'clone shared repo');
+ system(qw(git init --bare -q), "$v2/all.git") == 0 or die;
for my $i (0..2) {
is(system(@clone, $alt, "$v2/git/$i.git"), 0, "clone epoch $i");
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] t/www_listing: test "all" HTML listing
2019-12-26 6:48 [PATCH 0/3] some test coverage improvements Eric Wong
2019-12-26 6:48 ` [PATCH 1/3] t/www_listing: quiet down stderr in -httpd Eric Wong
@ 2019-12-26 6:48 ` Eric Wong
2019-12-26 6:48 ` [PATCH 3/3] t/solver_git: test with -httpd, too Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-12-26 6:48 UTC (permalink / raw)
To: meta
We now have coverage for PublicInbox::WwwListing::list_all.
---
t/www_listing.t | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/t/www_listing.t b/t/www_listing.t
index 2ff053de..e785ae9b 100644
--- a/t/www_listing.t
+++ b/t/www_listing.t
@@ -31,7 +31,10 @@ like(PublicInbox::WwwListing::fingerprint($bare), qr/\A[a-f0-9]{40}\z/,
sub tiny_test {
my ($json, $host, $port) = @_;
my $http = HTTP::Tiny->new;
- my $res = $http->get("http://$host:$port/manifest.js.gz");
+ my $res = $http->get("http://$host:$port/");
+ is($res->{status}, 200, 'got HTML listing');
+ like($res->{content}, qr!</html>!si, 'listing looks like HTML');
+ $res = $http->get("http://$host:$port/manifest.js.gz");
is($res->{status}, 200, 'got manifest');
my $tmp;
IO::Uncompress::Gunzip::gunzip(\(delete $res->{content}) => \$tmp);
@@ -85,6 +88,8 @@ SKIP: {
ok(unlink("$bare->{git_dir}/description"), 'removed bare/description');
open $fh, '>', $cfgfile or die;
print $fh <<"" or die;
+[publicinbox]
+ wwwlisting = all
[publicinbox "bare"]
inboxdir = $bare->{git_dir}
url = http://$host/bare
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] t/solver_git: test with -httpd, too
2019-12-26 6:48 [PATCH 0/3] some test coverage improvements Eric Wong
2019-12-26 6:48 ` [PATCH 1/3] t/www_listing: quiet down stderr in -httpd Eric Wong
2019-12-26 6:48 ` [PATCH 2/3] t/www_listing: test "all" HTML listing Eric Wong
@ 2019-12-26 6:48 ` Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2019-12-26 6:48 UTC (permalink / raw)
To: meta
Solver uses the internal -httpd async API if available for
fairness when applying large patchsets. We must test those
code paths in addition to the generic PSGI code paths.
---
t/solver_git.t | 42 +++++++++++++++++++++++++++++++-----------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/t/solver_git.t b/t/solver_git.t
index 4cadd06a..af5bf7bc 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -138,18 +138,26 @@ SKIP: {
# ensure the PSGI frontend (ViewVCS) works:
my $name = $ibx->{name};
my $cfgpfx = "publicinbox.$name";
- my $cfg = PublicInbox::Config->new(\<<EOF);
-$cfgpfx.address=$ibx->{address};
-$cfgpfx.inboxdir=$inboxdir
-$cfgpfx.coderepo=public-inbox
-$cfgpfx.coderepo=binfoo
-coderepo.public-inbox.dir=$git_dir
-coderepo.public-inbox.cgiturl=http://example.com/public-inbox
-coderepo.binfoo.dir=$binfoo
-coderepo.binfoo.cgiturl=http://example.com/binfoo
+ my $cfgpath = "$inboxdir/httpd-config";
+ open my $cfgfh, '>', $cfgpath or die;
+ print $cfgfh <<EOF or die;
+[publicinbox "$name"]
+ address = $ibx->{address};
+ inboxdir = $inboxdir
+ coderepo = public-inbox
+ coderepo = binfoo
+ url = http://example.com/$name
+[coderepo "public-inbox"]
+ dir = $git_dir
+ cgiturl = http://example.com/public-inbox
+[coderepo "binfoo"]
+ dir = $binfoo
+ cgiturl = http://example.com/binfoo
EOF
+ close $cfgfh or die;
+ my $cfg = PublicInbox::Config->new($cfgpath);
my $www = PublicInbox::WWW->new($cfg);
- test_psgi(sub { $www->call(@_) }, sub {
+ my $client = sub {
my ($cb) = @_;
my $res = $cb->(GET("/$name/3435775/s/"));
is($res->code, 200, 'success with existing blob');
@@ -169,7 +177,19 @@ EOF
is($res->content, "\0" x $size,
"$label content matches");
}
- });
+ };
+ test_psgi(sub { $www->call(@_) }, $client);
+ SKIP: {
+ require_mods(qw(Plack::Test::ExternalServer), 7);
+ my $env = { PI_CONFIG => $cfgpath };
+ my $sock = tcp_server() or die;
+ my ($out, $err) = map { "$inboxdir/std$_.log" } qw(out err);
+ my $cmd = [ qw(-httpd -W0), "--stdout=$out", "--stderr=$err" ];
+ my $td = start_script($cmd, $env, { 3 => $sock });
+ my ($h, $p) = ($sock->sockhost, $sock->sockport);
+ local $ENV{PLACK_TEST_EXTERNALSERVER_URI} = "http://$h:$p";
+ Plack::Test::ExternalServer::test_psgi(client => $client);
+ }
}
done_testing();
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-12-26 6:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-26 6:48 [PATCH 0/3] some test coverage improvements Eric Wong
2019-12-26 6:48 ` [PATCH 1/3] t/www_listing: quiet down stderr in -httpd Eric Wong
2019-12-26 6:48 ` [PATCH 2/3] t/www_listing: test "all" HTML listing Eric Wong
2019-12-26 6:48 ` [PATCH 3/3] t/solver_git: test with -httpd, too Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).