From d68983e060dcc95bb6879c6796f0c14da9488311 Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Mon, 3 Jun 2024 13:11:40 +0800 Subject: [PATCH] DEV: Use same `Socket.getaddrinfo` arguments as selenium-webdriver (#27301) Follow up to c408b53689c9c9627a518267cab737ee16cbec3d. We need better debugging information --- spec/rails_helper.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 1b7889eced0..1910fed89af 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -523,13 +523,22 @@ RSpec.configure do |config| example.run if example.exception.is_a?(Socket::ResolutionError) - info = Socket.getaddrinfo("localhost", nil) + info = Socket.getaddrinfo("localhost", 80, Socket::AF_INET, Socket::SOCK_STREAM) etc_hosts = `cat /etc/hosts` + resolve_conf = `cat /etc/resolv.conf` + nsswitch = `cat /etc/nsswitch.conf` + puts <<~MSG Failed to resolve localhost, available addresses: #{info} /etc/hosts: #{etc_hosts} + + /etc/resolv.conf: + #{resolve_conf} + + /etc/nsswitch.conf: + #{nsswitch} MSG end end