]> Sergey Matveev's repositories - public-inbox.git/commitdiff
t/pop3d: skip all tests if no certs are found
authorEric Wong <e@80x24.org>
Wed, 21 Sep 2022 17:02:54 +0000 (17:02 +0000)
committerEric Wong <e@80x24.org>
Wed, 21 Sep 2022 17:12:44 +0000 (17:12 +0000)
This test could be written with optional OpenSSL dependencies, but
it's probably not worth it since IO::Socket::SSL seems pretty
common.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://public-inbox.org/meta/20220921154741.siubptwcv4463w5l@pengutronix.de/
t/pop3d.t

index 7248c03f47c5f28726fa4b8fe88b4226359486ad..dc52b0cf84117ab15d81106896ea4d4f5f27d042 100644 (file)
--- a/t/pop3d.t
+++ b/t/pop3d.t
@@ -4,6 +4,13 @@
 use v5.12;
 use PublicInbox::TestCommon;
 use Socket qw(IPPROTO_TCP SOL_SOCKET);
+my $cert = 'certs/server-cert.pem';
+my $key = 'certs/server-key.pem';
+unless (-r $key && -r $cert) {
+       plan skip_all =>
+               "certs/ missing for $0, run $^X ./create-certs.perl in certs/";
+}
+
 # Net::POP3 is part of the standard library, but distros may split it off...
 require_mods(qw(DBD::SQLite Net::POP3 IO::Socket::SSL));
 require_git('2.6'); # for v2
@@ -44,14 +51,6 @@ my $pop3s_addr = tcp_host_port($pop3s);
 my $stls_addr = tcp_host_port($stls);
 my $plain_addr = tcp_host_port($plain);
 my $env = { PI_CONFIG => $pi_config };
-my $cert = 'certs/server-cert.pem';
-my $key = 'certs/server-key.pem';
-
-unless (-r $key && -r $cert) {
-       plan skip_all =>
-               "certs/ missing for $0, run $^X ./create-certs.perl in certs/";
-}
-
 my $old = start_script(['-pop3d', '-W0',
        "--stdout=$tmpdir/plain.out", "--stderr=$olderr" ],
        $env, { 3 => $plain });