diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-07-20 18:40:28 +0300 |
commit | b595cb0c1dec83de5bdee18284abe86614bed33b (patch) | |
tree | 8c3d4540f193c5ff98019352f554e921b3a41a72 /spec/frontend/fixtures | |
parent | 2f9104a328fc8a4bddeaa4627b595166d24671d0 (diff) |
Add latest changes from gitlab-org/gitlab@15-2-stable-eev15.2.0-rc42
Diffstat (limited to 'spec/frontend/fixtures')
-rw-r--r-- | spec/frontend/fixtures/api_deploy_keys.rb | 1 | ||||
-rw-r--r-- | spec/frontend/fixtures/blob.rb | 1 | ||||
-rw-r--r-- | spec/frontend/fixtures/deploy_keys.rb | 6 | ||||
-rw-r--r-- | spec/frontend/fixtures/jobs.rb | 98 | ||||
-rw-r--r-- | spec/frontend/fixtures/runner.rb | 16 |
5 files changed, 88 insertions, 34 deletions
diff --git a/spec/frontend/fixtures/api_deploy_keys.rb b/spec/frontend/fixtures/api_deploy_keys.rb index 7027b8c975b..5ffc726f086 100644 --- a/spec/frontend/fixtures/api_deploy_keys.rb +++ b/spec/frontend/fixtures/api_deploy_keys.rb @@ -11,6 +11,7 @@ RSpec.describe API::DeployKeys, '(JavaScript fixtures)', type: :request do let_it_be(:project2) { create(:project) } let_it_be(:deploy_key) { create(:deploy_key, public: true) } let_it_be(:deploy_key2) { create(:deploy_key, public: true) } + let_it_be(:deploy_key_without_fingerprint) { create(:deploy_key, :without_md5_fingerprint, public: true) } let_it_be(:deploy_keys_project) { create(:deploy_keys_project, :write_access, project: project, deploy_key: deploy_key) } let_it_be(:deploy_keys_project2) { create(:deploy_keys_project, :write_access, project: project2, deploy_key: deploy_key) } let_it_be(:deploy_keys_project3) { create(:deploy_keys_project, :write_access, project: project, deploy_key: deploy_key2) } diff --git a/spec/frontend/fixtures/blob.rb b/spec/frontend/fixtures/blob.rb index af548823886..b2bbdd2749e 100644 --- a/spec/frontend/fixtures/blob.rb +++ b/spec/frontend/fixtures/blob.rb @@ -12,7 +12,6 @@ RSpec.describe Projects::BlobController, '(JavaScript fixtures)', type: :control render_views before do - stub_feature_flags(refactor_blob_viewer: false) # This fixture is only used by the legacy (non-refactored) blob viewer sign_in(user) allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') end diff --git a/spec/frontend/fixtures/deploy_keys.rb b/spec/frontend/fixtures/deploy_keys.rb index bed6c798793..154084e0181 100644 --- a/spec/frontend/fixtures/deploy_keys.rb +++ b/spec/frontend/fixtures/deploy_keys.rb @@ -27,9 +27,9 @@ RSpec.describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :c render_views it 'deploy_keys/keys.json' do - create(:rsa_deploy_key_2048, public: true) - project_key = create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCdMHEHyhRjbhEZVddFn6lTWdgEy5Q6Bz4nwGB76xWZI5YT/1WJOMEW+sL5zYd31kk7sd3FJ5L9ft8zWMWrr/iWXQikC2cqZK24H1xy+ZUmrRuJD4qGAaIVoyyzBL+avL+lF8J5lg6YSw8gwJY/lX64/vnJHUlWw2n5BF8IFOWhiw== dummy@gitlab.com') - internal_key = create(:deploy_key, key: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDNd/UJWhPrpb+b/G5oL109y57yKuCxE+WUGJGYaj7WQKsYRJmLYh1mgjrl+KVyfsWpq4ylOxIfFSnN9xBBFN8mlb0Fma5DC7YsSsibJr3MZ19ZNBprwNcdogET7aW9I0In7Wu5f2KqI6e5W/spJHCy4JVxzVMUvk6Myab0LnJ2iQ== dummy@gitlab.com') + create(:rsa_deploy_key_5120, public: true) + project_key = create(:deploy_key) + internal_key = create(:deploy_key) create(:deploy_keys_project, project: project, deploy_key: project_key) create(:deploy_keys_project, project: project2, deploy_key: internal_key) create(:deploy_keys_project, project: project3, deploy_key: project_key) diff --git a/spec/frontend/fixtures/jobs.rb b/spec/frontend/fixtures/jobs.rb index 3cc87432655..2e15eefdce6 100644 --- a/spec/frontend/fixtures/jobs.rb +++ b/spec/frontend/fixtures/jobs.rb @@ -2,40 +2,94 @@ require 'spec_helper' -RSpec.describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do +RSpec.describe 'Jobs (JavaScript fixtures)' do + include ApiHelpers include JavaScriptFixturesHelpers + include GraphqlHelpers let(:namespace) { create(:namespace, name: 'frontend-fixtures' )} let(:project) { create(:project, :repository, namespace: namespace, path: 'builds-project') } let(:user) { project.first_owner } let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } - let!(:build_with_artifacts) { create(:ci_build, :success, :artifacts, :trace_artifact, pipeline: pipeline, stage: 'test', artifacts_expire_at: Time.now + 18.months) } - let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline, stage: 'build') } - let!(:pending_build) { create(:ci_build, :pending, pipeline: pipeline, stage: 'deploy') } - let!(:delayed_job) do - create(:ci_build, :scheduled, - pipeline: pipeline, - name: 'delayed job', - stage: 'test') + + after do + remove_repository(project) end - render_views + describe Projects::JobsController, type: :controller do + let!(:delayed) { create(:ci_build, :scheduled, pipeline: pipeline, name: 'delayed job') } - before do - sign_in(user) - end + before do + sign_in(user) + end - after do - remove_repository(project) + it 'jobs/delayed.json' do + get :show, params: { + namespace_id: project.namespace.to_param, + project_id: project, + id: delayed.to_param + }, format: :json + + expect(response).to be_successful + end end - it 'jobs/delayed.json' do - get :show, params: { - namespace_id: project.namespace.to_param, - project_id: project, - id: delayed_job.to_param - }, format: :json + describe GraphQL::Query, type: :request do + let(:artifact) { create(:ci_job_artifact, file_type: :archive, file_format: :zip) } + + let!(:build) { create(:ci_build, :success, name: 'build', pipeline: pipeline) } + let!(:cancelable) { create(:ci_build, :cancelable, name: 'cancelable', pipeline: pipeline) } + let!(:created_by_tag) { create(:ci_build, :success, name: 'created_by_tag', tag: true, pipeline: pipeline) } + let!(:pending) { create(:ci_build, :pending, name: 'pending', pipeline: pipeline) } + let!(:playable) { create(:ci_build, :playable, name: 'playable', pipeline: pipeline) } + let!(:retryable) { create(:ci_build, :retryable, name: 'retryable', pipeline: pipeline) } + let!(:scheduled) { create(:ci_build, :scheduled, name: 'scheduled', pipeline: pipeline) } + let!(:with_artifact) { create(:ci_build, :success, name: 'with_artifact', job_artifacts: [artifact], pipeline: pipeline) } + let!(:with_coverage) { create(:ci_build, :success, name: 'with_coverage', coverage: 40.0, pipeline: pipeline) } + + fixtures_path = 'graphql/jobs/' + get_jobs_query = 'get_jobs.query.graphql' + full_path = 'frontend-fixtures/builds-project' + + let_it_be(:query) do + get_graphql_query_as_string("jobs/components/table/graphql/queries/#{get_jobs_query}") + end + + it "#{fixtures_path}#{get_jobs_query}.json" do + post_graphql(query, current_user: user, variables: { + fullPath: full_path + }) + + expect_graphql_errors_to_be_empty + end + + it "#{fixtures_path}#{get_jobs_query}.as_guest.json" do + guest = create(:user) + project.add_guest(guest) + + post_graphql(query, current_user: guest, variables: { + fullPath: full_path + }) + + expect_graphql_errors_to_be_empty + end + + it "#{fixtures_path}#{get_jobs_query}.paginated.json" do + post_graphql(query, current_user: user, variables: { + fullPath: full_path, + first: 2 + }) + + expect_graphql_errors_to_be_empty + end + + it "#{fixtures_path}#{get_jobs_query}.empty.json" do + post_graphql(query, current_user: user, variables: { + fullPath: full_path, + first: 0 + }) - expect(response).to be_successful + expect_graphql_errors_to_be_empty + end end end diff --git a/spec/frontend/fixtures/runner.rb b/spec/frontend/fixtures/runner.rb index a79982fa647..36281af0219 100644 --- a/spec/frontend/fixtures/runner.rb +++ b/spec/frontend/fixtures/runner.rb @@ -29,7 +29,7 @@ RSpec.describe 'Runner (JavaScript fixtures)' do before do allow(Gitlab::Ci::RunnerUpgradeCheck.instance) .to receive(:check_runner_upgrade_status) - .and_return(:not_available) + .and_return({ not_available: nil }) end describe do @@ -39,19 +39,19 @@ RSpec.describe 'Runner (JavaScript fixtures)' do end describe GraphQL::Query, type: :request do - admin_runners_query = 'list/admin_runners.query.graphql' + all_runners_query = 'list/all_runners.query.graphql' let_it_be(:query) do - get_graphql_query_as_string("#{query_path}#{admin_runners_query}") + get_graphql_query_as_string("#{query_path}#{all_runners_query}") end - it "#{fixtures_path}#{admin_runners_query}.json" do + it "#{fixtures_path}#{all_runners_query}.json" do post_graphql(query, current_user: admin, variables: {}) expect_graphql_errors_to_be_empty end - it "#{fixtures_path}#{admin_runners_query}.paginated.json" do + it "#{fixtures_path}#{all_runners_query}.paginated.json" do post_graphql(query, current_user: admin, variables: { first: 2 }) expect_graphql_errors_to_be_empty @@ -59,13 +59,13 @@ RSpec.describe 'Runner (JavaScript fixtures)' do end describe GraphQL::Query, type: :request do - admin_runners_count_query = 'list/admin_runners_count.query.graphql' + all_runners_count_query = 'list/all_runners_count.query.graphql' let_it_be(:query) do - get_graphql_query_as_string("#{query_path}#{admin_runners_count_query}") + get_graphql_query_as_string("#{query_path}#{all_runners_count_query}") end - it "#{fixtures_path}#{admin_runners_count_query}.json" do + it "#{fixtures_path}#{all_runners_count_query}.json" do post_graphql(query, current_user: admin, variables: {}) expect_graphql_errors_to_be_empty |