Commit ca4db9d2 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Wait for Runner to register in QA and DRY page objects

parent 50a82f64
......@@ -35,12 +35,15 @@ module QA
runner.register!
end
sleep 5 # TODO, non-blocking waiting for Runner to register.
##
# TODO, refactor to support non-blocking wait time until
# GitLab Runner sucessfully registers itself.
#
sleep 5
settings.refresh
settings.expand_runners_settings do |runners|
perform&.call(runners)
perform&.call(runners, runner)
runner.remove!
end
end
......
......@@ -12,6 +12,10 @@ module QA
#
all('code').first.text
end
def has_online_runner?
page.has_css?('.runner-status-online')
end
end
end
end
......
......@@ -6,11 +6,11 @@ module QA
include Scenario::Actable
include Service::Shellout
attr_writer :token, :address, :tags, :image, :name
attr_accessor :token, :address, :tags, :image, :name
def initialize
@image = 'gitlab/gitlab-runner:alpine'
@name = "gitlab-runner-qa-#{SecureRandom.hex(4)}"
@name = "qa-runner-#{SecureRandom.hex(4)}"
end
def pull
......@@ -18,6 +18,10 @@ module QA
end
def register!
##
# TODO, this assumes that `test` network exists, because we know that
# gitlab-qa environment orchestration tool creates it.
#
shell <<~CMD.tr("\n", ' ')
docker run -d --rm --entrypoint=/bin/sh
--network test --name #{@name}
......
......@@ -5,11 +5,9 @@ module QA
Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Runner.fabricate! do |runner|
runner.name = 'my-qa-runner'
runner.perform do |page|
expect(page).to have_content('my-qa-runner')
expect(page).to have_css('.runner-status-online')
runner.perform do |page, runner|
expect(page).to have_content(runner.name)
expect(page).to have_online_runner
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment