unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH] t/solver_git: fix when Plack::Middleware::ReverseProxy is missing
Date: Mon, 13 Mar 2023 11:58:11 +0000	[thread overview]
Message-ID: <20230313115811.1911286-1-e@80x24.org> (raw)

We need to ignore the harmless warnings in stderr when
Plack::Middleware::ReverseProxy isn't installed.
---
 t/solver_git.t | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/t/solver_git.t b/t/solver_git.t
index 02d90e5d..00e58074 100644
--- a/t/solver_git.t
+++ b/t/solver_git.t
@@ -39,6 +39,13 @@ my $v1_0_0_tag = 'cb7c42b1e15577ed2215356a2bf925aef59cdd8d';
 my $v1_0_0_tag_short = substr($v1_0_0_tag, 0, 16);
 my $expect = '69df7d565d49fbaaeb0a067910f03dc22cd52bd0';
 my $non_existent = 'ee5e32211bf62ab6531bdf39b84b6920d0b6775a';
+my $stderr_empty = sub {
+	my ($msg) = @_;
+	open my $efh, '<', "$tmpdir/stderr.log" or xbail $!;
+	my @l = <$efh>;
+	@l = grep(!/reverse ?proxy/i, @l);
+	is_xdeeply(\@l, [], $msg // 'stderr.log is empty');
+};
 
 test_lei({tmpdir => "$tmpdir/blob"}, sub {
 	lei_ok('blob', '--mail', $patch2_oid, '-I', $ibx->{inboxdir},
@@ -342,8 +349,7 @@ EOF
 		# WwwCoderepo
 		my $olderr;
 		if (defined $ENV{PLACK_TEST_EXTERNALSERVER_URI}) {
-			ok(!-s "$tmpdir/stderr.log",
-				'nothing in stderr.log, yet');
+			$stderr_empty->('nothing in stderr.log, yet');
 		} else {
 			open $olderr, '>&', \*STDERR or xbail "open: $!";
 			open STDERR, '+>>', "$tmpdir/stderr.log" or
@@ -353,17 +359,17 @@ EOF
 		defined($ENV{PLACK_TEST_EXTERNALSERVER_URI}) or
 			open STDERR, '>&', $olderr or xbail "open: $!";
 		is($res->code, 200, 'coderepo summary (binfoo)');
-		ok(!-s "$tmpdir/stderr.log");
+		$stderr_empty->();
 
 		$res = $cb->(GET("/binfoo/$oid{'iso-8859-1'}/s/"));
 		is($res->code, 200, 'ISO-8859-1 commit');
 		like($res->content, qr/K&#229;g/, 'ISO-8859-1 commit message');
-		ok(!-s "$tmpdir/stderr.log", 'nothing in stderr');
+		$stderr_empty->();
 
 		$res = $cb->(GET("/binfoo/$oid{'8859-parent'}/s/"));
 		is($res->code, 200, 'commit w/ ISO-8859-parent');
 		like($res->content, qr/K&#229;g/, 'ISO-8859-1 commit message');
-		ok(!-s "$tmpdir/stderr.log", 'nothing in stderr');
+		$stderr_empty->();
 
 		$res = $cb->(GET('/public-inbox/'));
 		is($res->code, 200, 'coderepo summary (public-inbox)');

                 reply	other threads:[~2023-03-13 11:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230313115811.1911286-1-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.
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).