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 ...@@ -35,12 +35,15 @@ module QA
runner.register! runner.register!
end 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.refresh
settings.expand_runners_settings do |runners| settings.expand_runners_settings do |runners|
perform&.call(runners) perform&.call(runners, runner)
runner.remove! runner.remove!
end end
end end
......
...@@ -12,6 +12,10 @@ module QA ...@@ -12,6 +12,10 @@ module QA
# #
all('code').first.text all('code').first.text
end end
def has_online_runner?
page.has_css?('.runner-status-online')
end
end end
end end
end end
......
...@@ -6,11 +6,11 @@ module QA ...@@ -6,11 +6,11 @@ module QA
include Scenario::Actable include Scenario::Actable
include Service::Shellout include Service::Shellout
attr_writer :token, :address, :tags, :image, :name attr_accessor :token, :address, :tags, :image, :name
def initialize def initialize
@image = 'gitlab/gitlab-runner:alpine' @image = 'gitlab/gitlab-runner:alpine'
@name = "gitlab-runner-qa-#{SecureRandom.hex(4)}" @name = "qa-runner-#{SecureRandom.hex(4)}"
end end
def pull def pull
...@@ -18,6 +18,10 @@ module QA ...@@ -18,6 +18,10 @@ module QA
end end
def register! def register!
##
# TODO, this assumes that `test` network exists, because we know that
# gitlab-qa environment orchestration tool creates it.
#
shell <<~CMD.tr("\n", ' ') shell <<~CMD.tr("\n", ' ')
docker run -d --rm --entrypoint=/bin/sh docker run -d --rm --entrypoint=/bin/sh
--network test --name #{@name} --network test --name #{@name}
......
...@@ -5,11 +5,9 @@ module QA ...@@ -5,11 +5,9 @@ module QA
Page::Main::Login.act { sign_in_using_credentials } Page::Main::Login.act { sign_in_using_credentials }
Factory::Resource::Runner.fabricate! do |runner| Factory::Resource::Runner.fabricate! do |runner|
runner.name = 'my-qa-runner' runner.perform do |page, runner|
expect(page).to have_content(runner.name)
runner.perform do |page| expect(page).to have_online_runner
expect(page).to have_content('my-qa-runner')
expect(page).to have_css('.runner-status-online')
end end
end 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