Class: Gitlab::QA::Component::Gitlab::Availability

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/component/gitlab.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, relative_path: '', scheme: 'http', protocol_port: 80) ⇒ Availability

Returns a new instance of Availability.



182
183
184
185
186
187
188
189
# File 'lib/gitlab/qa/component/gitlab.rb', line 182

def initialize(name, relative_path: '', scheme: 'http', protocol_port: 80)
  @docker = Docker::Engine.new

  host = @docker.hostname
  port = @docker.port(name, protocol_port).split(':').last

  @uri = URI.join("#{scheme}://#{host}:#{port}", "#{relative_path}/", 'help')
end

Instance Method Details

#check(retries) ⇒ Object



191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/gitlab/qa/component/gitlab.rb', line 191

def check(retries)
  print "Waiting for GitLab at `#{@uri}` to become available "

  retries.times do
    return true if service_available?

    print '.'
    sleep 1
  end

  false
end