]> Sergey Matveev's repositories - public-inbox.git/blobdiff - t/imapd-tls.t
tests: favor IPv6
[public-inbox.git] / t / imapd-tls.t
index f81959a5826da3fe5729b77a340025a9234ebc7b..ab90ddec4738fb54fae016a6bd2518ac7956fe32 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2020 all contributors <meta@public-inbox.org>
+# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 use strict;
 use warnings;
@@ -7,7 +7,7 @@ use Socket qw(IPPROTO_TCP SOL_SOCKET);
 use PublicInbox::TestCommon;
 # IO::Poll is part of the standard library, but distros may split it off...
 require_mods(qw(DBD::SQLite IO::Socket::SSL Mail::IMAPClient IO::Poll
-       Email::Address::XS||Mail::Address));
+       Email::Address::XS||Mail::Address Parse::RecDescent));
 my $imap_client = 'Mail::IMAPClient';
 $imap_client->can('starttls') or
        plan skip_all => 'Mail::IMAPClient does not support TLS';
@@ -70,8 +70,8 @@ EOF
        }
 }
 
-my $imaps_addr = $imaps->sockhost . ':' . $imaps->sockport;
-my $starttls_addr = $starttls->sockhost . ':' . $starttls->sockport;
+my $imaps_addr = tcp_host_port($imaps);
+my $starttls_addr = tcp_host_port($starttls);
 my $env = { PI_CONFIG => $pi_config };
 my $td;
 
@@ -114,7 +114,9 @@ for my $args (
        ok(!(scalar $c->has_capability('STARTTLS')),
                'starttls not advertised with IMAPS');
        ok(!$c->starttls, "starttls fails");
-       ok($c->has_capability('COMPRESS'), 'compress advertised');
+       ok($c->has_capability('COMPRESS') ||
+               $c->has_capability('COMPRESS=DEFLATE'),
+               'compress advertised');
        ok($c->compress, 'compression enabled with IMAPS');
        ok(!$c->starttls, 'starttls still fails');
        ok($c->noop, 'noop succeeds');