Commit 963ebeb6 authored by Dan Davison's avatar Dan Davison

Merge branch 'gy-qa-unregister-runner' into 'master'

Ensure qa runners are unregistered after tests

Closes gitlab-qa#556

See merge request gitlab-org/gitlab!28013
parents bd5a247b 20d88db5
...@@ -13,3 +13,4 @@ This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec ...@@ -13,3 +13,4 @@ This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec
| `:quarantine` | The test has been [quarantined](https://about.gitlab.com/handbook/engineering/quality/guidelines/debugging-qa-test-failures/#quarantining-tests), will run in a separate job that only includes quarantined tests, and is allowed to fail. The test will be skipped in its regular job so that if it fails it will not hold up the pipeline. | | `:quarantine` | The test has been [quarantined](https://about.gitlab.com/handbook/engineering/quality/guidelines/debugging-qa-test-failures/#quarantining-tests), will run in a separate job that only includes quarantined tests, and is allowed to fail. The test will be skipped in its regular job so that if it fails it will not hold up the pipeline. |
| `:reliable` | The test has been [promoted to a reliable test](https://about.gitlab.com/handbook/engineering/quality/guidelines/reliable-tests/#promoting-an-existing-test-to-reliable) meaning it passes consistently in all pipelines, including merge requests. | | `:reliable` | The test has been [promoted to a reliable test](https://about.gitlab.com/handbook/engineering/quality/guidelines/reliable-tests/#promoting-an-existing-test-to-reliable) meaning it passes consistently in all pipelines, including merge requests. |
| `:requires_admin` | The test requires an admin account. Tests with the tag are excluded when run against Canary and Production environments. | | `:requires_admin` | The test requires an admin account. Tests with the tag are excluded when run against Canary and Production environments. |
| `:runner` | The test depends on and will set up a GitLab Runner instance, typically to run a pipeline. |
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Verify', :docker do context 'Verify', :docker, :runner do
describe 'Pipeline creation and processing' do describe 'Pipeline creation and processing' do
let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:max_wait) { 30 } let(:max_wait) { 30 }
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
end end
end end
before do let!(:runner) do
Resource::Runner.fabricate! do |runner| Resource::Runner.fabricate! do |runner|
runner.project = project runner.project = project
runner.name = executor runner.name = executor
...@@ -21,7 +21,7 @@ module QA ...@@ -21,7 +21,7 @@ module QA
end end
after do after do
Service::DockerRun::GitlabRunner.new(executor).remove! runner.remove_via_api!
end end
it 'users creates a pipeline which gets processed', :smoke do it 'users creates a pipeline which gets processed', :smoke do
......
# frozen_string_literal: true # frozen_string_literal: true
module QA module QA
context 'Verify', :docker do context 'Verify', :docker, :runner do
describe 'Runner registration' do describe 'Runner registration' do
let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:executor) { "qa-runner-#{Time.now.to_i}" }
let!(:runner) do
Resource::Runner.fabricate! do |runner|
runner.name = executor
end
end
after do after do
Service::DockerRun::GitlabRunner.new(executor).remove! runner.remove_via_api!
end end
it 'user registers a new specific runner' do it 'user registers a new specific runner' do
Flow::Login.sign_in Flow::Login.sign_in
Resource::Runner.fabricate! do |runner| runner.project.visit!
runner.name = executor
end.project.visit!
Page::Project::Menu.perform(&:go_to_ci_cd_settings) Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform do |settings| Page::Project::Settings::CICD.perform do |settings|
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'digest/sha1' require 'digest/sha1'
module QA module QA
context 'Release', :docker do context 'Release', :docker, :runner do
describe 'Git clone using a deploy key' do describe 'Git clone using a deploy key' do
before do before do
Flow::Login.sign_in Flow::Login.sign_in
...@@ -16,7 +16,7 @@ module QA ...@@ -16,7 +16,7 @@ module QA
@repository_location = @project.repository_ssh_location @repository_location = @project.repository_ssh_location
Resource::Runner.fabricate_via_api! do |resource| @runner = Resource::Runner.fabricate_via_api! do |resource|
resource.project = @project resource.project = @project
resource.name = @runner_name resource.name = @runner_name
resource.tags = %w[qa docker] resource.tags = %w[qa docker]
...@@ -25,7 +25,7 @@ module QA ...@@ -25,7 +25,7 @@ module QA
end end
after do after do
Service::DockerRun::GitlabRunner.new(@runner_name).remove! @runner.remove_via_api!
end end
keys = [ keys = [
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module QA module QA
# This test was quarantined because relative URL isn't supported # This test was quarantined because relative URL isn't supported
# See https://gitlab.com/gitlab-org/gitlab/issues/13833 # See https://gitlab.com/gitlab-org/gitlab/issues/13833
context 'Create', :quarantine do context 'Create', :runner, :quarantine do
describe 'Web IDE web terminal', :docker do describe 'Web IDE web terminal', :docker do
before do before do
project = Resource::Project.fabricate_via_api! do |project| project = Resource::Project.fabricate_via_api! do |project|
...@@ -48,8 +48,7 @@ module QA ...@@ -48,8 +48,7 @@ module QA
end end
after do after do
# Remove the runner even if the test fails @runner.remove_via_api! if @runner
Service::DockerRun::GitlabRunner.new(@runner.name).remove! if @runner
end end
it 'user starts the web terminal' do it 'user starts the web terminal' do
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
require 'securerandom' require 'securerandom'
module QA module QA
context 'Release', :docker do context 'Release', :docker, :runner do
describe 'Pipelines for merged results and merge trains' do describe 'Pipelines for merged results and merge trains' do
before(:context) do before(:context) do
@group = Resource::Group.fabricate_via_api! @group = Resource::Group.fabricate_via_api!
Resource::Runner.fabricate_via_api! do |runner| @runner = Resource::Runner.fabricate_via_api! do |runner|
runner.token = @group.reload!.runners_token runner.token = @group.reload!.runners_token
runner.name = @group.name runner.name = @group.name
runner.tags = [@group.name] runner.tags = [@group.name]
...@@ -55,7 +55,7 @@ module QA ...@@ -55,7 +55,7 @@ module QA
end end
after(:context) do after(:context) do
Service::DockerRun::GitlabRunner.new(@group.name).remove! @runner.remove_via_api! if @runner
end end
it 'creates a pipeline with merged results' do it 'creates a pipeline with merged results' do
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'pathname' require 'pathname'
module QA module QA
context 'Secure', :docker do context 'Secure', :docker, :runner do
describe 'Security Reports in a Merge Request' do describe 'Security Reports in a Merge Request' do
let(:sast_vuln_count) { 5 } let(:sast_vuln_count) { 5 }
let(:dependency_scan_vuln_count) { 4 } let(:dependency_scan_vuln_count) { 4 }
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
let(:remediable_vuln_name) { "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js" } let(:remediable_vuln_name) { "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js" }
after do after do
Service::DockerRun::GitlabRunner.new(@executor).remove! @runner.remove_via_api! if @runner
Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled
end end
...@@ -29,7 +29,7 @@ module QA ...@@ -29,7 +29,7 @@ module QA
p.initialize_with_readme = true p.initialize_with_readme = true
end end
Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = @executor runner.name = @executor
runner.tags = %w[qa test] runner.tags = %w[qa test]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'pathname' require 'pathname'
module QA module QA
context 'Secure', :docker do context 'Secure', :docker, :runner do
let(:approved_license_name) { "MIT" } let(:approved_license_name) { "MIT" }
let(:denied_license_name) { "WTFPL" } let(:denied_license_name) { "WTFPL" }
...@@ -42,7 +42,7 @@ module QA ...@@ -42,7 +42,7 @@ module QA
let(:number_of_licenses_in_fixture) { 2 } let(:number_of_licenses_in_fixture) { 2 }
after do after do
Service::DockerRun::GitlabRunner.new(@executor).remove! @runner.remove_via_api!
end end
before do before do
...@@ -55,7 +55,7 @@ module QA ...@@ -55,7 +55,7 @@ module QA
project.description = 'Project with Secure' project.description = 'Project with Secure'
end end
Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = @executor runner.name = @executor
runner.tags = %w[qa test] runner.tags = %w[qa test]
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
require 'pathname' require 'pathname'
module QA module QA
context 'Secure', :docker do context 'Secure', :docker, :runner do
describe 'License merge request widget' do describe 'License merge request widget' do
let(:approved_license_name) { "MIT" } let(:approved_license_name) { "MIT" }
let(:blacklisted_license_name) { "Zlib" } let(:blacklisted_license_name) { "Zlib" }
let(:executor) {"qa-runner-#{Time.now.to_i}"} let(:executor) {"qa-runner-#{Time.now.to_i}"}
after do after do
Service::DockerRun::GitlabRunner.new(executor).remove! @runner.remove_via_api!
end end
before do before do
...@@ -21,7 +21,7 @@ module QA ...@@ -21,7 +21,7 @@ module QA
project.description = 'License widget test' project.description = 'License widget test'
end end
Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = executor runner.name = executor
runner.tags = %w[qa test] runner.tags = %w[qa test]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'pathname' require 'pathname'
module QA module QA
context 'Secure', :docker do context 'Secure', :docker, :runner do
let(:number_of_dependencies_in_fixture) { 7 } let(:number_of_dependencies_in_fixture) { 7 }
let(:dependency_scan_example_vuln) { 'Prototype pollution attack in mixin-deep' } let(:dependency_scan_example_vuln) { 'Prototype pollution attack in mixin-deep' }
let(:container_scan_example_vuln) { 'CVE-2017-18269 in glibc' } let(:container_scan_example_vuln) { 'CVE-2017-18269 in glibc' }
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
describe 'Security Reports' do describe 'Security Reports' do
after(:all) do after(:all) do
Service::DockerRun::GitlabRunner.new(@executor).remove! @runner.remove_via_api!
end end
before(:all) do before(:all) do
...@@ -25,7 +25,7 @@ module QA ...@@ -25,7 +25,7 @@ module QA
p.description = 'Project with Secure' p.description = 'Project with Secure'
end end
Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = @executor runner.name = @executor
runner.tags = %w[qa test] runner.tags = %w[qa test]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'pathname' require 'pathname'
module QA module QA
context 'Secure', :docker do context 'Secure', :docker, :runner do
describe 'Security Reports in a Merge Request' do describe 'Security Reports in a Merge Request' do
let(:sast_vuln_count) { 5 } let(:sast_vuln_count) { 5 }
let(:dependency_scan_vuln_count) { 4 } let(:dependency_scan_vuln_count) { 4 }
...@@ -12,7 +12,7 @@ module QA ...@@ -12,7 +12,7 @@ module QA
let(:remediable_vuln_name) { "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js" } let(:remediable_vuln_name) { "Authentication bypass via incorrect DOM traversal and canonicalization in saml2-js" }
after(:all) do after(:all) do
Service::DockerRun::GitlabRunner.new(@executor).remove! @runner.remove_via_api!
Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled Runtime::Feature.enable('job_log_json') if @job_log_json_flag_enabled
end end
...@@ -29,7 +29,7 @@ module QA ...@@ -29,7 +29,7 @@ module QA
p.initialize_with_readme = true p.initialize_with_readme = true
end end
Resource::Runner.fabricate! do |runner| @runner = Resource::Runner.fabricate! do |runner|
runner.project = @project runner.project = @project
runner.name = @executor runner.name = @executor
runner.tags = %w[qa test] runner.tags = %w[qa test]
......
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