From ee5d0f8fc3ad10d8ccb9aac3348689d889cd0a84 Mon Sep 17 00:00:00 2001 From: Ricardo Signes Date: Tue, 6 Feb 2024 21:09:57 +0100 Subject: [PATCH] EmptyPort: isolate our own version of EmptyPort so we can try seeing if it is the problem --- t/dates.t | 4 ++-- t/exclusive.t | 4 ++-- t/httpendpoint.t | 4 ++-- t/https.t | 4 ++-- t/httpserver.t | 4 ++-- t/lib/Synergy/Test/EmptyPort.pm | 19 +++++++++++++++++++ t/lib/Synergy/Tester.pm | 2 +- t/page.t | 4 ++-- t/prometheus.t | 4 ++-- 9 files changed, 34 insertions(+), 15 deletions(-) create mode 100644 t/lib/Synergy/Test/EmptyPort.pm diff --git a/t/dates.t b/t/dates.t index ee5fd70d..acf7033d 100644 --- a/t/dates.t +++ b/t/dates.t @@ -5,7 +5,7 @@ use utf8; use experimental qw( signatures ); -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -15,7 +15,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Synergy::Hub; # Initialize Synergy. diff --git a/t/exclusive.t b/t/exclusive.t index 40d8eed8..486a9970 100644 --- a/t/exclusive.t +++ b/t/exclusive.t @@ -2,7 +2,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -12,7 +12,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Synergy::Hub; # Initialize Synergy. diff --git a/t/httpendpoint.t b/t/httpendpoint.t index 68488278..3961e97f 100644 --- a/t/httpendpoint.t +++ b/t/httpendpoint.t @@ -3,7 +3,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -13,7 +13,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Plack::Response; use MIME::Base64 'encode_base64'; use Synergy::Hub; diff --git a/t/https.t b/t/https.t index 984a7aaa..1cc43f82 100644 --- a/t/https.t +++ b/t/https.t @@ -3,7 +3,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -13,7 +13,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Plack::Response; use Synergy::Hub; diff --git a/t/httpserver.t b/t/httpserver.t index b5d4e987..6b5a3d95 100644 --- a/t/httpserver.t +++ b/t/httpserver.t @@ -3,7 +3,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -13,7 +13,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Plack::Response; use Synergy::Hub; diff --git a/t/lib/Synergy/Test/EmptyPort.pm b/t/lib/Synergy/Test/EmptyPort.pm new file mode 100644 index 00000000..257c2451 --- /dev/null +++ b/t/lib/Synergy/Test/EmptyPort.pm @@ -0,0 +1,19 @@ +package Synergy::Test::EmptyPort; +use strict; +use warnings; + +use experimental qw(signatures); + +use Net::EmptyPort (); + +use Sub::Exporter -setup => [ qw(empty_port) ]; + +sub empty_port () { + if ($ENV{GITHUB_ACTIONS}) { + return 60606; + } + + return Net::EmptyPort::empty_port(); +} + +1; diff --git a/t/lib/Synergy/Tester.pm b/t/lib/Synergy/Tester.pm index 6b2022c6..95fa7fe2 100644 --- a/t/lib/Synergy/Tester.pm +++ b/t/lib/Synergy/Tester.pm @@ -8,7 +8,7 @@ use Synergy::Logger::Test '$Logger'; use IO::Async::Test; use Synergy::Hub; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); package Synergy::Tester::Result { diff --git a/t/page.t b/t/page.t index 85b17e82..f0611b7a 100644 --- a/t/page.t +++ b/t/page.t @@ -2,7 +2,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -12,7 +12,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Path::Tiny (); use Synergy::Hub; diff --git a/t/prometheus.t b/t/prometheus.t index 59641140..af4756a8 100644 --- a/t/prometheus.t +++ b/t/prometheus.t @@ -3,7 +3,7 @@ use v5.32.0; use warnings; -use lib 'lib'; +use lib 'lib', 't/lib'; use Test::More; @@ -13,7 +13,7 @@ use IO::Async::Loop; use IO::Async::Test; use IO::Async::Timer::Periodic; use Net::Async::HTTP; -use Net::EmptyPort qw(empty_port); +use Synergy::Test::EmptyPort qw(empty_port); use Synergy::Hub; # Initialize Synergy.