Skip to content

Commit

Permalink
Test on CircleCI to try to reproduce #9
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Sep 6, 2024
1 parent 679d4fe commit 821567e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
command: sudo cpanm -iqn Test::Most Test::Needs
- run:
name: Install dependancies
command: sudo cpanm -iqn --installdeps .
command: sudo cpanm -ivn --installdeps .
- run:
name: Make Module
command: sudo chown -R circleci . && perl Makefile.PL && make
Expand Down
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for Locale::Places

0.14
Test on CircleCI

0.13 Sun Jul 21 09:31:13 EDT 2024
Handle broken smokers
http://www.cpantesters.org/cpan/report/47923180-216c-11ef-abf5-d5346e8775ea
Expand Down
26 changes: 14 additions & 12 deletions t/noopentickets.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
use strict;
use warnings;
use Test::Most tests => 4;
use constant SITE =>'https://api.github.com/repos/nigelhorne/Locale-Places/issues';
use constant URL =>'api.github.com';
use constant URL => 'https://api.github.com/repos/nigelhorne/Locale-Places/issues';
use constant SITE =>'api.github.com';

RT: {
# RT system, deprecated
Expand All @@ -15,8 +15,8 @@ RT: {
diag('WWW::RT::CPAN required to check for open tickets');
skip('WWW::RT::CPAN required to check for open tickets', 3);
} elsif(my @rc = @{WWW::RT::CPAN::list_dist_active_tickets(dist => 'Locale-Places')}) {
ok($rc[0] == 200);
ok($rc[1] eq 'OK');
cmp_ok($rc[0], '==', 200);
cmp_ok($rc[1], 'eq', 'OK');
my @tickets = $rc[2] ? @{$rc[2]} : ();

foreach my $ticket(@tickets) {
Expand All @@ -38,10 +38,10 @@ GITHUB: {
# https://docs.github.com/en/rest/reference/issues#list-repository-issues
SKIP: {
if($ENV{'AUTHOR_TESTING'}) {
eval 'use JSON';
eval 'use JSON::MaybeXS';
if($@) {
diag('JSON required to check for open tickets');
skip('JSON required to check for open tickets', 1);
diag('JSON::MaybeXS required to check for open tickets');
skip('JSON::MaybeXS required to check for open tickets', 1);
} else {
eval 'use IO::Socket::INET';
if($@) {
Expand All @@ -50,6 +50,7 @@ GITHUB: {
} else {
my $s = IO::Socket::INET->new(
PeerAddr => SITE,
PeerPort => 'http(80)',
Timeout => 5
);
if($s) {
Expand All @@ -59,7 +60,7 @@ GITHUB: {
diag('LWP::Simple required to check for open tickets');
skip('LWP::Simple required to check for open tickets', 1);
} elsif(my $data = LWP::Simple::get(URL)) {
my $json = JSON->new()->utf8();
my $json = JSON::MaybeXS->new()->utf8();
my @issues = @{$json->decode($data)};
# diag(Data::Dumper->new([\@issues])->Dump());
if($ENV{'TEST_VERBOSE'}) {
Expand All @@ -70,12 +71,13 @@ GITHUB: {
}
cmp_ok(scalar(@issues), '==', 0, 'There are no opentickets');
} else {
diag(URL, ': failed to get data');
fail('Failed to get data');
diag(URL, ': failed to get data - ignoring');
# fail('Failed to get data');
skip(URL . ': failed to get data - ignoring', 1);
}
} else {
diag("Can't connect to ", SITE);
skip("Can't connect to " . SITE, 1);
diag("Can't connect to ", SITE, ": $IO::Socket::errstr");
skip("Can't connect to " . SITE . ": $IO::Socket::errstr", 1);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions t/pod.t
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!perl -T
#!perl -w

use strict;
use warnings;
use Test::Most;

if($ENV{AUTHOR_TESTING}) {
if($ENV{'AUTHOR_TESTING'}) {
# Ensure a recent version of Test::Pod
my $min_tp = 1.22;
eval "use Test::Pod $min_tp";
Expand Down

0 comments on commit 821567e

Please sign in to comment.