Skip to content

Commit

Permalink
optional tests should be required at release time
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Nov 12, 2024
1 parent 6922800 commit fb58de1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 10 deletions.
7 changes: 6 additions & 1 deletion t/190_find_CA.t
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions t/200_live.t
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions t/200_live_local_ip.t
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions t/210_live_ssl.t
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down

0 comments on commit fb58de1

Please sign in to comment.