From fb58de16a9dfdb5b4bf25ff17d77284168f8c134 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Tue, 12 Nov 2024 13:39:21 +0100 Subject: [PATCH] optional tests should be required at release time --- t/190_find_CA.t | 7 ++++++- t/200_live.t | 6 +++--- t/200_live_local_ip.t | 6 +++--- t/210_live_ssl.t | 6 +++--- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/t/190_find_CA.t b/t/190_find_CA.t index 99dc99a..f0f30ef 100644 --- a/t/190_find_CA.t +++ b/t/190_find_CA.t @@ -8,7 +8,7 @@ use lib 't'; use HTTP::Tiny; plan 'skip_all' => "Only run if HTTP::Tiny->can_ssl()" - unless HTTP::Tiny->can_ssl(); # also requires IO::Socket:SSL + unless $ENV{RELEASE_TESTING} || HTTP::Tiny->can_ssl(); # also requires IO::Socket:SSL delete $ENV{SSL_CERT_FILE}; @@ -20,6 +20,11 @@ $ENV{SSL_CERT_FILE} = "corpus/snake-oil.crt"; my $handle = HTTP::Tiny::Handle->new(); +# RELEASE_TESTING may skip this call, so ensure it is done again. _find_CA +# relies on IO::Socket::SSL being loaded, which would always be done if we +# weren't bypassing the public API. +HTTP::Tiny->can_ssl; + my %ret = $handle->_find_CA(); is($ret{SSL_ca_file}, "corpus/snake-oil.crt", diff --git a/t/200_live.t b/t/200_live.t index 399d9a9..a7a9663 100644 --- a/t/200_live.t +++ b/t/200_live.t @@ -11,11 +11,11 @@ my $test_host = "google.com"; my $test_url = "http://www.google.com/"; my $test_re = qr/google/; -plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING}" - unless $ENV{AUTOMATED_TESTING}; +plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING} or \$ENV{RELEASE_TESTING}" + unless $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING}; plan 'skip_all' => "Internet connection timed out" - unless IO::Socket::INET->new( + unless $ENV{RELEASE_TESTING} || IO::Socket::INET->new( PeerHost => $test_host, PeerPort => 80, Proto => 'tcp', diff --git a/t/200_live_local_ip.t b/t/200_live_local_ip.t index 0993a8d..af81757 100644 --- a/t/200_live_local_ip.t +++ b/t/200_live_local_ip.t @@ -10,11 +10,11 @@ use HTTP::Tiny; my $test_host = "www.google.com"; my $test_url = "http://www.google.com/"; -plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING}" - unless $ENV{AUTOMATED_TESTING}; +plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING} or \$ENV{RELEASE_TESTING}" + unless $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING}; plan 'skip_all' => "Internet connection timed out" - unless IO::Socket::INET->new( + unless $ENV{RELEASE_TESTING} || IO::Socket::INET->new( PeerHost => $test_host, PeerPort => 80, Proto => 'tcp', diff --git a/t/210_live_ssl.t b/t/210_live_ssl.t index 7cd82c4..9fa0134 100644 --- a/t/210_live_ssl.t +++ b/t/210_live_ssl.t @@ -8,11 +8,11 @@ use IO::Socket::INET; use HTTP::Tiny; -plan skip_all => 'Only run for $ENV{AUTOMATED_TESTING}' - unless $ENV{AUTOMATED_TESTING}; +plan 'skip_all' => "Only run for \$ENV{AUTOMATED_TESTING} or \$ENV{RELEASE_TESTING}" + unless $ENV{AUTOMATED_TESTING} || $ENV{RELEASE_TESTING}; plan skip_all => "Only run if HTTP::Tiny->can_ssl()" - unless HTTP::Tiny->can_ssl(); + unless $ENV{RELEASE_TESTING} || HTTP::Tiny->can_ssl(); delete $ENV{PERL_HTTP_TINY_SSL_INSECURE_BY_DEFAULT};