Class: Gitlab::QA::Component::Gitlab::Availability
- Inherits:
-
Object
- Object
- Gitlab::QA::Component::Gitlab::Availability
- Defined in:
- lib/gitlab/qa/component/gitlab.rb
Instance Method Summary collapse
- #check(retries) ⇒ Object
-
#initialize(name, relative_path: '', scheme: 'http', protocol_port: 80) ⇒ Availability
constructor
A new instance of Availability.
- #uri ⇒ Object
Constructor Details
#initialize(name, relative_path: '', scheme: 'http', protocol_port: 80) ⇒ Availability
Returns a new instance of Availability.
289 290 291 292 293 294 295 296 |
# File 'lib/gitlab/qa/component/gitlab.rb', line 289 def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80) @docker = Docker::Engine.new @name = name @scheme = scheme @relative_path = relative_path @protocol_port = protocol_port end |
Instance Method Details
#check(retries) ⇒ Object
298 299 300 301 302 303 304 305 306 |
# File 'lib/gitlab/qa/component/gitlab.rb', line 298 def check(retries) retries.times do return true if service_available? sleep 1 end false end |
#uri ⇒ Object
308 309 310 311 312 313 314 |
# File 'lib/gitlab/qa/component/gitlab.rb', line 308 def uri @uri ||= begin port = docker.port(name, protocol_port).split(':').last URI.join("#{scheme}://#{docker.hostname}:#{port}", relative_path) end end |