Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 13:00:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-20 13:00:54 +0300
commit3cccd102ba543e02725d247893729e5c73b38295 (patch)
treef36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/requests/api/graphql/ci
parent205943281328046ef7b4528031b90fbda70c75ac (diff)
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/requests/api/graphql/ci')
-rw-r--r--spec/requests/api/graphql/ci/job_spec.rb1
-rw-r--r--spec/requests/api/graphql/ci/jobs_spec.rb50
-rw-r--r--spec/requests/api/graphql/ci/runner_spec.rb57
-rw-r--r--spec/requests/api/graphql/ci/runners_spec.rb2
4 files changed, 83 insertions, 27 deletions
diff --git a/spec/requests/api/graphql/ci/job_spec.rb b/spec/requests/api/graphql/ci/job_spec.rb
index b0514a0a963..ddb2664d353 100644
--- a/spec/requests/api/graphql/ci/job_spec.rb
+++ b/spec/requests/api/graphql/ci/job_spec.rb
@@ -52,6 +52,7 @@ RSpec.describe 'Query.project(fullPath).pipelines.job(id)' do
'name' => job_2.name,
'allowFailure' => job_2.allow_failure,
'duration' => 25,
+ 'kind' => 'BUILD',
'queuedDuration' => 2.0,
'status' => job_2.status.upcase
)
diff --git a/spec/requests/api/graphql/ci/jobs_spec.rb b/spec/requests/api/graphql/ci/jobs_spec.rb
index b191b585d06..2d1bb45390b 100644
--- a/spec/requests/api/graphql/ci/jobs_spec.rb
+++ b/spec/requests/api/graphql/ci/jobs_spec.rb
@@ -155,6 +155,56 @@ RSpec.describe 'Query.project.pipeline' do
end
end
+ describe '.jobs.kind' do
+ let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
+
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ pipeline(iid: "#{pipeline.iid}") {
+ stages {
+ nodes {
+ groups{
+ nodes {
+ jobs {
+ nodes {
+ kind
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ )
+ end
+
+ context 'when the job is a build' do
+ it 'returns BUILD' do
+ create(:ci_build, pipeline: pipeline)
+
+ post_graphql(query, current_user: user)
+
+ job_data = graphql_data_at(:project, :pipeline, :stages, :nodes, :groups, :nodes, :jobs, :nodes).first
+ expect(job_data['kind']).to eq 'BUILD'
+ end
+ end
+
+ context 'when the job is a bridge' do
+ it 'returns BRIDGE' do
+ create(:ci_bridge, pipeline: pipeline)
+
+ post_graphql(query, current_user: user)
+
+ job_data = graphql_data_at(:project, :pipeline, :stages, :nodes, :groups, :nodes, :jobs, :nodes).first
+ expect(job_data['kind']).to eq 'BRIDGE'
+ end
+ end
+ end
+
describe '.jobs.artifacts' do
let_it_be(:pipeline) { create(:ci_pipeline, project: project) }
diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb
index b99a3d14fb9..39f0f696b08 100644
--- a/spec/requests/api/graphql/ci/runner_spec.rb
+++ b/spec/requests/api/graphql/ci/runner_spec.rb
@@ -27,27 +27,18 @@ 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
+ before do
+ allow(Gitlab::Ci::RunnerUpgradeCheck.instance).to receive(:check_runner_upgrade_status)
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 +48,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 +80,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 +97,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 +105,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 +124,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 +135,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 +184,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 +362,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 +387,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
diff --git a/spec/requests/api/graphql/ci/runners_spec.rb b/spec/requests/api/graphql/ci/runners_spec.rb
index 267dd1b5e6f..6b88c82b025 100644
--- a/spec/requests/api/graphql/ci/runners_spec.rb
+++ b/spec/requests/api/graphql/ci/runners_spec.rb
@@ -34,6 +34,8 @@ RSpec.describe 'Query.runners' do
end
before do
+ allow(Gitlab::Ci::RunnerUpgradeCheck.instance).to receive(:check_runner_upgrade_status)
+
post_graphql(query, current_user: current_user)
end