diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-29 03:09:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-29 03:09:30 +0300 |
commit | a60762f1c9c446bcd3c53b363b5f87f31278d4cb (patch) | |
tree | 5096170da07bc49cd15aed8cd8ca6607fa879e3d /spec/requests/api | |
parent | f138af0ccd6bbea99420b435248242b417f9d476 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api')
-rw-r--r-- | spec/requests/api/graphql/ci/config_spec.rb | 26 | ||||
-rw-r--r-- | spec/requests/api/lint_spec.rb | 28 |
2 files changed, 53 insertions, 1 deletions
diff --git a/spec/requests/api/graphql/ci/config_spec.rb b/spec/requests/api/graphql/ci/config_spec.rb index 62b15a8396c..d5ef9fdd783 100644 --- a/spec/requests/api/graphql/ci/config_spec.rb +++ b/spec/requests/api/graphql/ci/config_spec.rb @@ -57,6 +57,16 @@ RSpec.describe 'Query.ciConfig' do } } } + mergedYaml + includes { + type + location + blob + raw + extra + contextProject + contextSha + } } } ) @@ -71,10 +81,12 @@ RSpec.describe 'Query.ciConfig' do it 'returns the correct structure' do post_graphql_query - expect(graphql_data['ciConfig']).to eq( + expect(graphql_data['ciConfig']).to include( "status" => "VALID", "errors" => [], "warnings" => [], + "includes" => [], + "mergedYaml" => a_kind_of(String), "stages" => { "nodes" => @@ -271,6 +283,18 @@ RSpec.describe 'Query.ciConfig' do "status" => "VALID", "errors" => [], "warnings" => [], + "includes" => [ + { + "type" => "local", + "location" => "other_file.yml", + "blob" => "http://localhost/#{project.full_path}/-/blob/#{project.commit.sha}/other_file.yml", + "raw" => "http://localhost/#{project.full_path}/-/raw/#{project.commit.sha}/other_file.yml", + "extra" => {}, + "contextProject" => project.full_path, + "contextSha" => project.commit.sha + } + ], + "mergedYaml" => "---\nbuild:\n script: build\nrspec:\n script: rspec\n", "stages" => { "nodes" => diff --git a/spec/requests/api/lint_spec.rb b/spec/requests/api/lint_spec.rb index ef7f5ee87dc..148410ecaa8 100644 --- a/spec/requests/api/lint_spec.rb +++ b/spec/requests/api/lint_spec.rb @@ -123,6 +123,7 @@ RSpec.describe API::Lint do expect(json_response['status']).to eq('valid') expect(json_response['warnings']).to match_array([]) expect(json_response['errors']).to match_array([]) + expect(json_response['includes']).to eq([]) end it 'outputs expanded yaml content' do @@ -177,6 +178,7 @@ RSpec.describe API::Lint do expect(json_response['status']).to eq('invalid') expect(json_response['warnings']).to eq([]) expect(json_response['errors']).to eq(['Invalid configuration format']) + expect(json_response['includes']).to eq(nil) end it 'outputs expanded yaml content' do @@ -204,6 +206,7 @@ RSpec.describe API::Lint do expect(json_response['status']).to eq('invalid') expect(json_response['warnings']).to eq([]) expect(json_response['errors']).to eq(['jobs config should contain at least one visible job']) + expect(json_response['includes']).to eq([]) end it 'outputs expanded yaml content' do @@ -262,6 +265,17 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash expect(json_response['merged_yaml']).to eq(expected_yaml) + expect(json_response['includes']).to contain_exactly( + { + 'type' => 'local', + 'location' => 'another-gitlab-ci.yml', + 'blob' => "http://localhost/#{project.full_path}/-/blob/#{project.commit.sha}/another-gitlab-ci.yml", + 'raw' => "http://localhost/#{project.full_path}/-/raw/#{project.commit.sha}/another-gitlab-ci.yml", + 'extra' => {}, + 'context_project' => project.full_path, + 'context_sha' => project.commit.sha + } + ) expect(json_response['valid']).to eq(true) expect(json_response['warnings']).to eq([]) expect(json_response['errors']).to eq([]) @@ -274,6 +288,7 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response['merged_yaml']).to eq(yaml_content) + expect(json_response['includes']).to eq([]) expect(json_response['valid']).to eq(false) expect(json_response['warnings']).to eq([]) expect(json_response['errors']).to eq(['jobs config should contain at least one visible job']) @@ -327,6 +342,7 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response['merged_yaml']).to eq(nil) + expect(json_response['includes']).to eq(nil) expect(json_response['valid']).to eq(false) expect(json_response['warnings']).to eq([]) expect(json_response['errors']).to eq(['Insufficient permissions to create a new pipeline']) @@ -539,6 +555,17 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Hash expect(json_response['merged_yaml']).to eq(expected_yaml) + expect(json_response['includes']).to contain_exactly( + { + 'type' => 'local', + 'location' => 'another-gitlab-ci.yml', + 'blob' => "http://localhost/#{project.full_path}/-/blob/#{project.commit.sha}/another-gitlab-ci.yml", + 'raw' => "http://localhost/#{project.full_path}/-/raw/#{project.commit.sha}/another-gitlab-ci.yml", + 'extra' => {}, + 'context_project' => project.full_path, + 'context_sha' => project.commit.sha + } + ) expect(json_response['valid']).to eq(true) expect(json_response['errors']).to eq([]) end @@ -550,6 +577,7 @@ RSpec.describe API::Lint do expect(response).to have_gitlab_http_status(:ok) expect(json_response['merged_yaml']).to eq(yaml_content) + expect(json_response['includes']).to eq([]) expect(json_response['valid']).to eq(false) expect(json_response['errors']).to eq(['jobs config should contain at least one visible job']) end |