lib/percy/network_helpers.rb in percy-common-3.1.5 vs lib/percy/network_helpers.rb in percy-common-3.1.6

- old
+ new

@@ -26,25 +26,27 @@ rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Errno::EADDRINUSE false end end - def self.verify_healthcheck(url:, expected_body: 'ok', retry_wait_seconds: 0.5) + def self.verify_healthcheck(url:, expected_body: 'ok', retry_wait_seconds: 0.5, proxy: nil) 10.times do begin - response = Excon.get(url) + response = Excon.get(url, proxy: proxy) return true if response.body == expected_body rescue Excon::Error::Socket, Excon::Error::Timeout sleep retry_wait_seconds end end raise ServerDown, "Healthcheck failed for #{url}" end - def self.verify_http_server_up(hostname, port: nil, path: nil, retry_wait_seconds: 0.25) + def self.verify_http_server_up(hostname, port: nil, + path: nil, retry_wait_seconds: 0.25, proxy: nil) 10.times do begin - Excon.get("http://#{hostname}#{port.nil? ? '' : ':' + port.to_s}#{path || ''}") + url = "http://#{hostname}#{port.nil? ? '' : ':' + port.to_s}#{path || ''}" + Excon.get(url, proxy: proxy) return true rescue Excon::Error::Socket, Excon::Error::Timeout sleep retry_wait_seconds end end