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] t/nntpd*.t: skip TLS tests for old Net::NNTP
Date: Sun, 30 Jun 2019 00:16:59 +0000	[thread overview]
Message-ID: <20190630001659.4431-1-e@80x24.org> (raw)

Perl prior to 5.22 did not bundle a Net::NNTP (or libnet)
capable of handling TLS.
---
 t/nntpd-tls.t | 3 +++
 t/nntpd.t     | 9 +++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/t/nntpd-tls.t b/t/nntpd-tls.t
index 427d370f..e3ecdd4f 100644
--- a/t/nntpd-tls.t
+++ b/t/nntpd-tls.t
@@ -11,6 +11,9 @@ foreach my $mod (qw(DBD::SQLite IO::Socket::SSL Net::NNTP IO::Poll)) {
 	eval "require $mod";
 	plan skip_all => "$mod missing for $0" if $@;
 }
+Net::NNTP->can('starttls') or
+	plan skip_all => 'Net::NNTP does not support TLS';
+
 my $cert = 'certs/server-cert.pem';
 my $key = 'certs/server-key.pem';
 unless (-r $key && -r $cert) {
diff --git a/t/nntpd.t b/t/nntpd.t
index 6cba2be4..bf5bb883 100644
--- a/t/nntpd.t
+++ b/t/nntpd.t
@@ -106,8 +106,13 @@ EOF
 	is_deeply($list, { $group => [ qw(1 1 n) ] }, 'LIST works');
 	is_deeply([$n->group($group)], [ qw(0 1 1), $group ], 'GROUP works');
 	is_deeply($n->listgroup($group), [1], 'listgroup OK');
-	ok(!$n->starttls, 'STARTTLS fails when unconfigured');
-	is($n->code, 580, 'got 580 code on server w/o TLS');
+
+	SKIP: {
+		$n->can('starttls') or
+			skip('Net::NNTP too old to support STARTTLS', 2);
+		ok(!$n->starttls, 'STARTTLS fails when unconfigured');
+		is($n->code, 580, 'got 580 code on server w/o TLS');
+	};
 
 	%opts = (
 		PeerAddr => $host_port,
-- 
EW


                 reply	other threads:[~2019-06-30  0:16 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=20190630001659.4431-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.
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).