summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-09-10 17:26:42 -0600
committermo khan <mo.khan@gmail.com>2020-09-10 17:26:55 -0600
commit74e13689a8491a3d3544a74426226b0b1133b73c (patch)
treeba9d8c8bc3e798948e468c9e8d1e3fe3af00345d
parentc1322bd38dfe4d47cdf5c51ff3ae298f5e5c7f88 (diff)
test: Warm up proxy server
-rw-r--r--spec/support/proxy_server.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/support/proxy_server.rb b/spec/support/proxy_server.rb
index 721921a..0ef676d 100644
--- a/spec/support/proxy_server.rb
+++ b/spec/support/proxy_server.rb
@@ -28,6 +28,8 @@ class ProxyServer
end
config_file = License::Management.root.join("spec/fixtures/haproxy.cfg")
self.pid = spawn("/usr/sbin/haproxy -f #{config_file}")
+ wait_for_server
+ pid
end
def stop(pid = self.pid)
@@ -49,4 +51,12 @@ class ProxyServer
system("echo '#{ip} #{name}' >> /etc/hosts")
end
+
+ def wait_for_server
+ DOMAINS.each do |domain|
+ puts "Warming up #{domain}..."
+ print "." until system("curl -s -k https://#{domain} > /dev/null")
+ puts "#{domain} is ready!"
+ end
+ end
end