svn commit: r1937475 - spamassassin/trunk/t

[email protected]
Newsgroups gmane.mail.spam.spamassassin.cvs
Message-ID <178773065353.2405656.13700026924518112012@svn03-he-fi>
Author: gbechis
Date: Wed Aug 26 07:50:53 2026
New Revision: 1937475

Log:
Check that Selenium is actually running before trying the test

Modified:
   spamassassin/trunk/t/redirectors.t

Modified: spamassassin/trunk/t/redirectors.t
==============================================================================
--- spamassassin/trunk/t/redirectors.t	Wed Aug 26 07:44:18 2026	(r1937474)
+++ spamassassin/trunk/t/redirectors.t	Wed Aug 26 07:50:53 2026	(r1937475)
@@ -8,7 +8,21 @@ use Test::More;
 use constant HAS_LWP_USERAGENT => eval { require LWP::UserAgent; require LWP::Protocol::https; };
 use constant HAS_DBI => eval { require DBI; };
 use constant HAS_DBD_SQLITE => eval { require DBD::SQLite; DBD::SQLite->VERSION(1.59_01); };
-use constant HAS_SELENIUM => eval { require Selenium::Remote::Driver; };
+
+# The Selenium::Remote::Driver module being installed doesn't mean a
+# WebDriver server is actually reachable; probe the default
+# url_redirector_selenium_host/port so this section is skipped cleanly
+# in environments without one running, instead of failing.
+use constant HAS_SELENIUM => eval { require Selenium::Remote::Driver } && eval {
+  require IO::Socket::INET;
+  my $sock = IO::Socket::INET->new(
+    PeerAddr => '127.0.0.1', PeerPort => 4444,
+    Proto => 'tcp', Timeout => 2,
+  );
+  my $ok = defined $sock;
+  $sock->close if $ok;
+  $ok;
+};
 
 use constant SQLITE => (HAS_DBI && HAS_DBD_SQLITE);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.