user/dev discussion of public-inbox itself
 help / color / Atom feed
* [PATCH] t/nntpd*.t: skip TLS tests for old Net::NNTP
@ 2019-06-30  0:16 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-06-30  0:16 UTC (permalink / raw)
  To: meta

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-30  0:16 [PATCH] t/nntpd*.t: skip TLS tests for old Net::NNTP Eric Wong

user/dev discussion of public-inbox itself

Archives are clonable:
	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

Example config snippet for mirrors

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.org/gmane.mail.public-inbox.general

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git