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.



174
175
176
177
178
179
180
181
# File 'lib/gitlab/qa/component/gitlab.rb', line 174

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



183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/gitlab/qa/component/gitlab.rb', line 183

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