user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 3/3] t/solver_git: test with -httpd, too
Date: Thu, 26 Dec 2019 06:48:04 +0000	[thread overview]
Message-ID: <20191226064804.23024-4-e@80x24.org> (raw)
In-Reply-To: <20191226064804.23024-1-e@80x24.org>

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();

      parent reply	other threads:[~2019-12-26  6:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191226064804.23024-4-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).