Commit ff58c109 authored by Kerri Miller's avatar Kerri Miller

Merge branch 'pedropombeiro/356671/small-fixes' into 'master'

Small fixes

See merge request gitlab-org/gitlab!84584
parents f72c75f4 981f87aa
......@@ -17,7 +17,7 @@ RSpec.describe Gitlab::Ci::RunnerUpgradeCheck do
end
context 'with available_runner_releases configured up to 14.1.1' do
let(:available_runner_releases) { %w[13.9.0 13.9.1 13.9.2 13.10.0 13.10.1 14.0.0 14.0.1 14.0.2 14.1.0 14.1.1] }
let(:available_runner_releases) { %w[13.9.0 13.9.1 13.9.2 13.10.0 13.10.1 14.0.0 14.0.1 14.0.2 14.1.0 14.1.1 14.1.1-rc3] }
context 'with nil runner_version' do
let(:runner_version) { nil }
......@@ -60,15 +60,20 @@ RSpec.describe Gitlab::Ci::RunnerUpgradeCheck do
context 'with valid params' do
where(:runner_version, :expected_result) do
'v14.1.0' | :not_available # not available since the GitLab instance is still on 14.0.x
'v14.0.1' | :recommended # recommended upgrade since 14.0.2 is available
'v14.0.2' | :not_available # not available since 14.0.2 is the latest 14.0.x release available
'v13.10.1' | :available # available upgrade: 14.1.1
'v13.10.0' | :recommended # recommended upgrade since 13.10.1 is available
'v13.9.2' | :recommended # recommended upgrade since backports are no longer released for this version
'v13.9.0' | :recommended # recommended upgrade since backports are no longer released for this version
'v13.8.1' | :recommended # recommended upgrade since build is too old (missing in records)
'v11.4.1' | :recommended # recommended upgrade since build is too old (missing in records)
'v14.1.0-rc3' | :not_available # not available since the GitLab instance is still on 14.0.x
'v14.1.0~beta.1574.gf6ea9389' | :not_available # suffixes are correctly handled
'v14.1.0/1.1.0' | :not_available # suffixes are correctly handled
'v14.1.0' | :not_available # not available since the GitLab instance is still on 14.0.x
'v14.0.1' | :recommended # recommended upgrade since 14.0.2 is available
'v14.0.2' | :not_available # not available since 14.0.2 is the latest 14.0.x release available
'v13.10.1' | :available # available upgrade: 14.1.1
'v13.10.1~beta.1574.gf6ea9389' | :available # suffixes are correctly handled
'v13.10.1/1.1.0' | :available # suffixes are correctly handled
'v13.10.0' | :recommended # recommended upgrade since 13.10.1 is available
'v13.9.2' | :recommended # recommended upgrade since backports are no longer released for this version
'v13.9.0' | :recommended # recommended upgrade since backports are no longer released for this version
'v13.8.1' | :recommended # recommended upgrade since build is too old (missing in records)
'v11.4.1' | :recommended # recommended upgrade since build is too old (missing in records)
end
with_them do
......
......@@ -134,28 +134,28 @@ RSpec.describe Ci::Runner do
end
context 'cost factors validations' do
it 'dissalows :private_projects_minutes_cost_factor being nil' do
it 'disallows :private_projects_minutes_cost_factor being nil' do
runner = build(:ci_runner, private_projects_minutes_cost_factor: nil)
expect(runner).to be_invalid
expect(runner.errors.full_messages).to include('Private projects minutes cost factor needs to be non-negative')
end
it 'dissalows :public_projects_minutes_cost_factor being nil' do
it 'disallows :public_projects_minutes_cost_factor being nil' do
runner = build(:ci_runner, public_projects_minutes_cost_factor: nil)
expect(runner).to be_invalid
expect(runner.errors.full_messages).to include('Public projects minutes cost factor needs to be non-negative')
end
it 'dissalows :private_projects_minutes_cost_factor being negative' do
it 'disallows :private_projects_minutes_cost_factor being negative' do
runner = build(:ci_runner, private_projects_minutes_cost_factor: -1.1)
expect(runner).to be_invalid
expect(runner.errors.full_messages).to include('Private projects minutes cost factor needs to be non-negative')
end
it 'dissalows :public_projects_minutes_cost_factor being negative' do
it 'disallows :public_projects_minutes_cost_factor being negative' do
runner = build(:ci_runner, public_projects_minutes_cost_factor: -2.2)
expect(runner).to be_invalid
......
......@@ -27,27 +27,14 @@ RSpec.describe 'Query.runner(id)' do
let_it_be(:active_project_runner) { create(:ci_runner, :project) }
def get_runner(id)
case id
when :active_instance_runner
active_instance_runner
when :inactive_instance_runner
inactive_instance_runner
when :active_group_runner
active_group_runner
when :active_project_runner
active_project_runner
end
end
shared_examples 'runner details fetch' do |runner_id|
shared_examples 'runner details fetch' do
let(:query) do
wrap_fields(query_graphql_path(query_path, all_graphql_fields_for('CiRunner')))
end
let(:query_path) do
[
[:runner, { id: get_runner(runner_id).to_global_id.to_s }]
[:runner, { id: runner.to_global_id.to_s }]
]
end
......@@ -57,7 +44,6 @@ RSpec.describe 'Query.runner(id)' do
runner_data = graphql_data_at(:runner)
expect(runner_data).not_to be_nil
runner = get_runner(runner_id)
expect(runner_data).to match a_hash_including(
'id' => runner.to_global_id.to_s,
'description' => runner.description,
......@@ -90,14 +76,14 @@ RSpec.describe 'Query.runner(id)' do
end
end
shared_examples 'retrieval with no admin url' do |runner_id|
shared_examples 'retrieval with no admin url' do
let(:query) do
wrap_fields(query_graphql_path(query_path, all_graphql_fields_for('CiRunner')))
end
let(:query_path) do
[
[:runner, { id: get_runner(runner_id).to_global_id.to_s }]
[:runner, { id: runner.to_global_id.to_s }]
]
end
......@@ -107,7 +93,6 @@ RSpec.describe 'Query.runner(id)' do
runner_data = graphql_data_at(:runner)
expect(runner_data).not_to be_nil
runner = get_runner(runner_id)
expect(runner_data).to match a_hash_including(
'id' => runner.to_global_id.to_s,
'adminUrl' => nil
......@@ -116,14 +101,14 @@ RSpec.describe 'Query.runner(id)' do
end
end
shared_examples 'retrieval by unauthorized user' do |runner_id|
shared_examples 'retrieval by unauthorized user' do
let(:query) do
wrap_fields(query_graphql_path(query_path, all_graphql_fields_for('CiRunner')))
end
let(:query_path) do
[
[:runner, { id: get_runner(runner_id).to_global_id.to_s }]
[:runner, { id: runner.to_global_id.to_s }]
]
end
......@@ -135,7 +120,9 @@ RSpec.describe 'Query.runner(id)' do
end
describe 'for active runner' do
it_behaves_like 'runner details fetch', :active_instance_runner
let(:runner) { active_instance_runner }
it_behaves_like 'runner details fetch'
context 'when tagList is not requested' do
let(:query) do
......@@ -144,7 +131,7 @@ RSpec.describe 'Query.runner(id)' do
let(:query_path) do
[
[:runner, { id: active_instance_runner.to_global_id.to_s }]
[:runner, { id: runner.to_global_id.to_s }]
]
end
......@@ -193,7 +180,9 @@ RSpec.describe 'Query.runner(id)' do
end
describe 'for inactive runner' do
it_behaves_like 'runner details fetch', :inactive_instance_runner
let(:runner) { inactive_instance_runner }
it_behaves_like 'runner details fetch'
end
describe 'for group runner request' do
......@@ -369,15 +358,21 @@ RSpec.describe 'Query.runner(id)' do
let(:user) { create(:user) }
context 'on instance runner' do
it_behaves_like 'retrieval by unauthorized user', :active_instance_runner
let(:runner) { active_instance_runner }
it_behaves_like 'retrieval by unauthorized user'
end
context 'on group runner' do
it_behaves_like 'retrieval by unauthorized user', :active_group_runner
let(:runner) { active_group_runner }
it_behaves_like 'retrieval by unauthorized user'
end
context 'on project runner' do
it_behaves_like 'retrieval by unauthorized user', :active_project_runner
let(:runner) { active_project_runner }
it_behaves_like 'retrieval by unauthorized user'
end
end
......@@ -388,13 +383,17 @@ RSpec.describe 'Query.runner(id)' do
group.add_user(user, Gitlab::Access::OWNER)
end
it_behaves_like 'retrieval with no admin url', :active_group_runner
it_behaves_like 'retrieval with no admin url' do
let(:runner) { active_group_runner }
end
end
describe 'by unauthenticated user' do
let(:user) { nil }
it_behaves_like 'retrieval by unauthorized user', :active_instance_runner
it_behaves_like 'retrieval by unauthorized user' do
let(:runner) { active_instance_runner }
end
end
describe 'Query limits' do
......
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