diff --git a/qa/qa/factory/resource/runner.rb b/qa/qa/factory/resource/runner.rb index 037136dd113..9d11f3c572f 100644 --- a/qa/qa/factory/resource/runner.rb +++ b/qa/qa/factory/resource/runner.rb @@ -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 diff --git a/qa/qa/page/project/settings/runners.rb b/qa/qa/page/project/settings/runners.rb index ba3dc632c59..ac93c3efddd 100644 --- a/qa/qa/page/project/settings/runners.rb +++ b/qa/qa/page/project/settings/runners.rb @@ -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 diff --git a/qa/qa/service/runner.rb b/qa/qa/service/runner.rb index a9906b8627a..2745bf00ded 100644 --- a/qa/qa/service/runner.rb +++ b/qa/qa/service/runner.rb @@ -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} diff --git a/qa/qa/specs/features/project/pipelines_spec.rb b/qa/qa/specs/features/project/pipelines_spec.rb index 1897b2fa27c..84e5a0e93cf 100644 --- a/qa/qa/specs/features/project/pipelines_spec.rb +++ b/qa/qa/specs/features/project/pipelines_spec.rb @@ -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