diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 18:07:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-29 18:07:02 +0300 |
commit | a466e9450d5949aa762913729918db02b5d27761 (patch) | |
tree | 8edfaac5434413a7fe160a6e50dfaee8ecf0f151 /spec | |
parent | d1d4dfb74a55a1b56b9451b2a844c57e05c9557f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
49 files changed, 173 insertions, 90 deletions
diff --git a/spec/controllers/admin/runner_projects_controller_spec.rb b/spec/controllers/admin/runner_projects_controller_spec.rb index 98f961f66bb..5e4fee17e67 100644 --- a/spec/controllers/admin/runner_projects_controller_spec.rb +++ b/spec/controllers/admin/runner_projects_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::RunnerProjectsController do +RSpec.describe Admin::RunnerProjectsController, feature_category: :runner do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } diff --git a/spec/controllers/admin/runners_controller_spec.rb b/spec/controllers/admin/runners_controller_spec.rb index 9e852cb28dd..a73071e14b3 100644 --- a/spec/controllers/admin/runners_controller_spec.rb +++ b/spec/controllers/admin/runners_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Admin::RunnersController do +RSpec.describe Admin::RunnersController, feature_category: :runner do let_it_be(:runner) { create(:ci_runner) } let_it_be(:user) { create(:admin) } diff --git a/spec/controllers/groups/runners_controller_spec.rb b/spec/controllers/groups/runners_controller_spec.rb index 2add3cd3b18..0e349e1d53f 100644 --- a/spec/controllers/groups/runners_controller_spec.rb +++ b/spec/controllers/groups/runners_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Groups::RunnersController do +RSpec.describe Groups::RunnersController, feature_category: :runner do let_it_be(:user) { create(:user) } let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } diff --git a/spec/controllers/projects/runners_controller_spec.rb b/spec/controllers/projects/runners_controller_spec.rb index 1066c4ec9f6..dba78617e89 100644 --- a/spec/controllers/projects/runners_controller_spec.rb +++ b/spec/controllers/projects/runners_controller_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Projects::RunnersController do +RSpec.describe Projects::RunnersController, feature_category: :runner do let(:user) { create(:user) } let(:project) { create(:project) } let(:runner) { create(:ci_runner, :project, projects: [project]) } diff --git a/spec/factories/ci/builds.rb b/spec/factories/ci/builds.rb index eb9ec3e0483..3762defc4bf 100644 --- a/spec/factories/ci/builds.rb +++ b/spec/factories/ci/builds.rb @@ -546,9 +546,12 @@ FactoryBot.define do options do { image: { name: 'image:1.0', entrypoint: '/bin/sh' }, - services: ['postgres', { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }], + services: ['postgres', + { name: 'docker:stable-dind', entrypoint: '/bin/sh', command: 'sleep 30', alias: 'docker' }, + { name: 'mysql:latest', variables: { MYSQL_ROOT_PASSWORD: 'root123.' } }], script: %w(echo), after_script: %w(ls date), + hooks: { pre_get_sources_script: ["echo 'hello pre_get_sources_script'"] }, artifacts: { name: 'artifacts_file', untracked: false, diff --git a/spec/features/profiles/keys_spec.rb b/spec/features/profiles/keys_spec.rb index 2fcf0ef730a..7a2a12d8dca 100644 --- a/spec/features/profiles/keys_spec.rb +++ b/spec/features/profiles/keys_spec.rb @@ -80,7 +80,7 @@ RSpec.describe 'Profile > SSH Keys', feature_category: :users do shared_examples 'removes key' do it 'removes key' do visit path - click_button('Delete') + find('[data-testid=remove-icon]').click page.within('.modal') do page.click_button('Delete') diff --git a/spec/fixtures/api/schemas/public_api/v4/deploy_key.json b/spec/fixtures/api/schemas/public_api/v4/deploy_key.json index 99e57a4c218..4f8b5c8422e 100644 --- a/spec/fixtures/api/schemas/public_api/v4/deploy_key.json +++ b/spec/fixtures/api/schemas/public_api/v4/deploy_key.json @@ -7,20 +7,50 @@ "expires_at", "key", "fingerprint_sha256", + "usage_type", "projects_with_write_access" ], "properties": { - "id": { "type": "integer" }, - "title": { "type": "string" }, - "created_at": { "type": "string", "format": "date-time" }, - "expires_at": { "type": ["string", "null"], "format": "date-time" }, - "key": { "type": "string" }, - "fingerprint": { "type": "string" }, - "fingerprint_sha256": { "type": "string" }, + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "expires_at": { + "type": [ + "string", + "null" + ], + "format": "date-time" + }, + "key": { + "type": "string" + }, + "fingerprint": { + "type": "string" + }, + "fingerprint_sha256": { + "type": "string" + }, + "usage_type": { + "type": "string", + "enum": [ + "auth", + "signing", + "auth_and_signing" + ] + }, "projects_with_write_access": { "type": "array", - "items": { "$ref": "project/identity.json" } + "items": { + "$ref": "project/identity.json" + } } }, "additionalProperties": false -} +}
\ No newline at end of file diff --git a/spec/graphql/mutations/ci/runner/bulk_delete_spec.rb b/spec/graphql/mutations/ci/runner/bulk_delete_spec.rb index 2eccfd3409f..7300d2ad5bd 100644 --- a/spec/graphql/mutations/ci/runner/bulk_delete_spec.rb +++ b/spec/graphql/mutations/ci/runner/bulk_delete_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Mutations::Ci::Runner::BulkDelete do +RSpec.describe Mutations::Ci::Runner::BulkDelete, feature_category: :runner do include GraphqlHelpers let_it_be(:admin_user) { create(:user, :admin) } diff --git a/spec/graphql/mutations/ci/runner/delete_spec.rb b/spec/graphql/mutations/ci/runner/delete_spec.rb index 06d360430f8..e21b35602cc 100644 --- a/spec/graphql/mutations/ci/runner/delete_spec.rb +++ b/spec/graphql/mutations/ci/runner/delete_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Mutations::Ci::Runner::Delete do +RSpec.describe Mutations::Ci::Runner::Delete, feature_category: :runner do include GraphqlHelpers let_it_be(:runner) { create(:ci_runner) } diff --git a/spec/graphql/mutations/ci/runner/update_spec.rb b/spec/graphql/mutations/ci/runner/update_spec.rb index 098b7ac6aa4..35a44740065 100644 --- a/spec/graphql/mutations/ci/runner/update_spec.rb +++ b/spec/graphql/mutations/ci/runner/update_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Mutations::Ci::Runner::Update do +RSpec.describe Mutations::Ci::Runner::Update, feature_category: :runner do include GraphqlHelpers let_it_be(:user) { create(:user) } diff --git a/spec/graphql/types/commit_signatures/ssh_signature_type_spec.rb b/spec/graphql/types/commit_signatures/ssh_signature_type_spec.rb index 4632fe59592..4ffb70a0b22 100644 --- a/spec/graphql/types/commit_signatures/ssh_signature_type_spec.rb +++ b/spec/graphql/types/commit_signatures/ssh_signature_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GitlabSchema.types['SshSignature'] do +RSpec.describe GitlabSchema.types['SshSignature'], feature_category: :source_code_management do specify { expect(described_class.graphql_name).to eq('SshSignature') } specify { expect(described_class).to require_graphql_authorizations(:download_code) } diff --git a/spec/graphql/types/key_type_spec.rb b/spec/graphql/types/key_type_spec.rb index a0a91be7c81..78144076467 100644 --- a/spec/graphql/types/key_type_spec.rb +++ b/spec/graphql/types/key_type_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe GitlabSchema.types['Key'] do +RSpec.describe GitlabSchema.types['Key'], feature_category: :authentication_and_authorization do specify { expect(described_class.graphql_name).to eq('Key') } it 'contains attributes for SSH keys' do diff --git a/spec/lib/api/ci/helpers/runner_helpers_spec.rb b/spec/lib/api/ci/helpers/runner_helpers_spec.rb index b254c419cbc..d32f7e4f0be 100644 --- a/spec/lib/api/ci/helpers/runner_helpers_spec.rb +++ b/spec/lib/api/ci/helpers/runner_helpers_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Helpers::Runner do +RSpec.describe API::Ci::Helpers::Runner, feature_category: :runner do let(:ip_address) { '1.2.3.4' } let(:runner_class) do Class.new do diff --git a/spec/lib/api/entities/ssh_key_spec.rb b/spec/lib/api/entities/ssh_key_spec.rb index 768ad416fbe..9d0acf69274 100644 --- a/spec/lib/api/entities/ssh_key_spec.rb +++ b/spec/lib/api/entities/ssh_key_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Entities::SSHKey do +RSpec.describe API::Entities::SSHKey, feature_category: :authentication_and_authorization do describe '#as_json' do subject { entity.as_json } @@ -15,8 +15,19 @@ RSpec.describe API::Entities::SSHKey do title: key.title, created_at: key.created_at, expires_at: key.expires_at, - key: key.publishable_key + key: key.publishable_key, + usage_type: 'auth_and_signing' ) end + + context 'when ssh_key_usage_types is disabled' do + before do + stub_feature_flags(ssh_key_usage_types: false) + end + + it 'does not include usage type field' do + expect(subject.keys).not_to include(:usage_type) + end + end end end diff --git a/spec/lib/gitlab/ci/build/hook_spec.rb b/spec/lib/gitlab/ci/build/hook_spec.rb new file mode 100644 index 00000000000..6ed40a44c97 --- /dev/null +++ b/spec/lib/gitlab/ci/build/hook_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Gitlab::Ci::Build::Hook, feature_category: :pipeline_authoring do + let_it_be(:build1) do + FactoryBot.build(:ci_build, + options: { hooks: { pre_get_sources_script: ["echo 'hello pre_get_sources_script'"] } }) + end + + describe '.from_hooks' do + subject(:from_hooks) { described_class.from_hooks(build1) } + + it 'initializes and returns hooks' do + expect(from_hooks.size).to eq(1) + expect(from_hooks[0].name).to eq('pre_get_sources_script') + expect(from_hooks[0].script).to eq(["echo 'hello pre_get_sources_script'"]) + end + end +end diff --git a/spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb b/spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb index ce1ee2fcda0..35e1c48a942 100644 --- a/spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb +++ b/spec/lib/gitlab/ci/pipeline/chain/populate_metadata_spec.rb @@ -89,6 +89,18 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::PopulateMetadata do expect(pipeline.pipeline_metadata).to be_nil end + + context 'with empty name after variable substitution' do + let(:config) do + { workflow: { name: '$VAR1' }, rspec: { script: 'rspec' } } + end + + it 'does not save empty name' do + run_chain + + expect(pipeline.pipeline_metadata).to be_nil + end + end end context 'with variables' do @@ -106,7 +118,7 @@ RSpec.describe Gitlab::Ci::Pipeline::Chain::PopulateMetadata do it 'substitutes variables' do run_chain - expect(pipeline.pipeline_metadata.name).to eq('Pipeline value value1 value2 ') + expect(pipeline.pipeline_metadata.name).to eq('Pipeline value value1 value2') end end diff --git a/spec/lib/gitlab/database/query_analyzers/query_recorder_spec.rb b/spec/lib/gitlab/database/query_analyzers/query_recorder_spec.rb index 65d00f420e6..ec01ae623ae 100644 --- a/spec/lib/gitlab/database/query_analyzers/query_recorder_spec.rb +++ b/spec/lib/gitlab/database/query_analyzers/query_recorder_spec.rb @@ -12,8 +12,7 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::QueryRecorder, query_analyzers: context 'when analyzer is enabled for tests' do let(:query) { 'SELECT 1 FROM projects' } - let(:log_path) { Rails.root.join(described_class::LOG_PATH) } - let(:log_file) { described_class.log_file } + let(:log_path) { Rails.root.join(described_class::LOG_FILE) } before do stub_env('CI', 'true') @@ -28,39 +27,12 @@ RSpec.describe Gitlab::Database::QueryAnalyzers::QueryRecorder, query_analyzers: it 'logs queries to a file' do allow(FileUtils).to receive(:mkdir_p) - .with(log_path) + .with(File.dirname(log_path)) expect(File).to receive(:write) - .with(log_file, /^{"sql":"#{query}/, mode: 'a') + .with(log_path, /^{"sql":"#{query}/, mode: 'a') expect(described_class).to receive(:analyze).with(/^#{query}/).and_call_original expect { ApplicationRecord.connection.execute(query) }.not_to raise_error end end - - describe '.log_file' do - let(:folder) { 'query_recorder' } - let(:extension) { 'ndjson' } - let(:default_name) { 'rspec' } - let(:job_name) { 'test-job-1' } - - subject { described_class.log_file.to_s } - - context 'when in CI' do - before do - stub_env('CI_JOB_NAME_SLUG', job_name) - end - - it { is_expected.to include("#{folder}/#{job_name}.#{extension}") } - it { is_expected.not_to include("#{folder}/#{default_name}.#{extension}") } - end - - context 'when not in CI' do - before do - stub_env('CI_JOB_NAME_SLUG', nil) - end - - it { is_expected.to include("#{folder}/#{default_name}.#{extension}") } - it { is_expected.not_to include("#{folder}/#{job_name}.#{extension}") } - end - end end diff --git a/spec/lib/gitlab/fips_spec.rb b/spec/lib/gitlab/fips_spec.rb index 4d19a44f617..50ab2889ccf 100644 --- a/spec/lib/gitlab/fips_spec.rb +++ b/spec/lib/gitlab/fips_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Gitlab::FIPS do let(:fips_mode_env_var) { nil } before do - expect(OpenSSL).to receive(:fips_mode).and_return(openssl_fips_mode) + allow(OpenSSL).to receive(:fips_mode).and_return(openssl_fips_mode) stub_env("FIPS_MODE", fips_mode_env_var) end diff --git a/spec/migrations/20220922143143_schedule_reset_duplicate_ci_runners_token_values_spec.rb b/spec/migrations/20220922143143_schedule_reset_duplicate_ci_runners_token_values_spec.rb index 409f7d544ee..a0041bb9fd2 100644 --- a/spec/migrations/20220922143143_schedule_reset_duplicate_ci_runners_token_values_spec.rb +++ b/spec/migrations/20220922143143_schedule_reset_duplicate_ci_runners_token_values_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleResetDuplicateCiRunnersTokenValues, migration: :gitlab_ci do +RSpec.describe ScheduleResetDuplicateCiRunnersTokenValues, feature_category: :runner, migration: :gitlab_ci do let(:migration) { described_class::MIGRATION } describe '#up' do diff --git a/spec/migrations/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values_spec.rb b/spec/migrations/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values_spec.rb index 4f3103927d5..4b3e9bfef05 100644 --- a/spec/migrations/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values_spec.rb +++ b/spec/migrations/20220922143634_schedule_reset_duplicate_ci_runners_token_encrypted_values_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleResetDuplicateCiRunnersTokenEncryptedValues, migration: :gitlab_ci do +RSpec.describe ScheduleResetDuplicateCiRunnersTokenEncryptedValues, feature_category: :runner, migration: :gitlab_ci do let(:migration) { described_class::MIGRATION } describe '#up' do diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb index 22fa020ad02..c03bb61f1f8 100644 --- a/spec/models/ci/build_spec.rb +++ b/spec/models/ci/build_spec.rb @@ -5616,4 +5616,19 @@ RSpec.describe Ci::Build do end end end + + describe '#runtime_hooks' do + let(:build1) do + FactoryBot.build(:ci_build, + options: { hooks: { pre_get_sources_script: ["echo 'hello pre_get_sources_script'"] } }) + end + + subject(:runtime_hooks) { build1.runtime_hooks } + + it 'returns an array of hook objects' do + expect(runtime_hooks.size).to eq(1) + expect(runtime_hooks[0].name).to eq('pre_get_sources_script') + expect(runtime_hooks[0].script).to eq(["echo 'hello pre_get_sources_script'"]) + end + end end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 5b796e57dea..56c21e8171f 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::Runner do +RSpec.describe Ci::Runner, feature_category: :runner do include StubGitlabCalls it_behaves_like 'having unique enum values' diff --git a/spec/models/ci/runner_version_spec.rb b/spec/models/ci/runner_version_spec.rb index 7a4b2e8f21e..deed51daa55 100644 --- a/spec/models/ci/runner_version_spec.rb +++ b/spec/models/ci/runner_version_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::RunnerVersion do +RSpec.describe Ci::RunnerVersion, feature_category: :runner do it_behaves_like 'having unique enum values' let_it_be(:runner_version_not_available) do diff --git a/spec/models/ci/running_build_spec.rb b/spec/models/ci/running_build_spec.rb index 84ef946980f..1a5ea044ba3 100644 --- a/spec/models/ci/running_build_spec.rb +++ b/spec/models/ci/running_build_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::RunningBuild do +RSpec.describe Ci::RunningBuild, feature_category: :continuous_integration do let_it_be(:project) { create(:project) } let_it_be(:pipeline) { create(:ci_pipeline, project: project) } diff --git a/spec/policies/ci/runner_policy_spec.rb b/spec/policies/ci/runner_policy_spec.rb index 773d3d9a01d..6039d60ec2f 100644 --- a/spec/policies/ci/runner_policy_spec.rb +++ b/spec/policies/ci/runner_policy_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::RunnerPolicy do +RSpec.describe Ci::RunnerPolicy, feature_category: :runner do describe 'ability :read_runner' do let_it_be(:guest) { create(:user) } let_it_be(:developer) { create(:user) } diff --git a/spec/requests/api/ci/runner/jobs_request_post_spec.rb b/spec/requests/api/ci/runner/jobs_request_post_spec.rb index 1cb4cc93ea5..232c339de57 100644 --- a/spec/requests/api/ci/runner/jobs_request_post_spec.rb +++ b/spec/requests/api/ci/runner/jobs_request_post_spec.rb @@ -175,6 +175,10 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do 'allow_failure' => true }] end + let(:expected_hooks) do + [{ 'name' => 'pre_get_sources_script', 'script' => ["echo 'hello pre_get_sources_script'"] }] + end + let(:expected_variables) do [{ 'key' => 'CI_JOB_NAME', 'value' => 'spinach', 'public' => true, 'masked' => false }, { 'key' => 'CI_JOB_STAGE', 'value' => 'test', 'public' => true, 'masked' => false }, @@ -230,6 +234,7 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do 'variables' => [{ 'key' => 'MYSQL_ROOT_PASSWORD', 'value' => 'root123.' }], 'pull_policy' => nil } ]) expect(json_response['steps']).to eq(expected_steps) + expect(json_response['hooks']).to eq(expected_hooks) expect(json_response['artifacts']).to eq(expected_artifacts) expect(json_response['cache']).to match(expected_cache) expect(json_response['variables']).to include(*expected_variables) @@ -769,6 +774,19 @@ RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do end end end + + context 'when the FF ci_hooks_pre_get_sources_script is disabled' do + before do + stub_feature_flags(ci_hooks_pre_get_sources_script: false) + end + + it 'does not return the pre_get_sources_script' do + request_job + + expect(response).to have_gitlab_http_status(:created) + expect(json_response).not_to have_key('hooks') + end + end end describe 'port support' do diff --git a/spec/requests/api/ci/runner/runners_delete_spec.rb b/spec/requests/api/ci/runner/runners_delete_spec.rb index 9d1bae7cce8..d53c9d3c644 100644 --- a/spec/requests/api/ci/runner/runners_delete_spec.rb +++ b/spec/requests/api/ci/runner/runners_delete_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do +RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state, feature_category: :runner do include StubGitlabCalls include RedisHelpers include WorkhorseHelpers diff --git a/spec/requests/api/ci/runner/runners_post_spec.rb b/spec/requests/api/ci/runner/runners_post_spec.rb index 47302046865..a501437e21a 100644 --- a/spec/requests/api/ci/runner/runners_post_spec.rb +++ b/spec/requests/api/ci/runner/runners_post_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do +RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state, feature_category: :runner do describe '/api/v4/runners' do describe 'POST /api/v4/runners' do context 'when no token is provided' do diff --git a/spec/requests/api/ci/runner/runners_reset_spec.rb b/spec/requests/api/ci/runner/runners_reset_spec.rb index 02b66a89a0a..43e9f7ddf38 100644 --- a/spec/requests/api/ci/runner/runners_reset_spec.rb +++ b/spec/requests/api/ci/runner/runners_reset_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do +RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state, feature_category: :runner do include StubGitlabCalls include RedisHelpers include WorkhorseHelpers diff --git a/spec/requests/api/ci/runner/runners_verify_post_spec.rb b/spec/requests/api/ci/runner/runners_verify_post_spec.rb index 038e126deaa..22a954cc444 100644 --- a/spec/requests/api/ci/runner/runners_verify_post_spec.rb +++ b/spec/requests/api/ci/runner/runners_verify_post_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state do +RSpec.describe API::Ci::Runner, :clean_gitlab_redis_shared_state, feature_category: :runner do include StubGitlabCalls include RedisHelpers include WorkhorseHelpers diff --git a/spec/requests/api/ci/runners_reset_registration_token_spec.rb b/spec/requests/api/ci/runners_reset_registration_token_spec.rb index b8e4370fd46..6ac341240ca 100644 --- a/spec/requests/api/ci/runners_reset_registration_token_spec.rb +++ b/spec/requests/api/ci/runners_reset_registration_token_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runners do +RSpec.describe API::Ci::Runners, feature_category: :runner do subject { post api("#{prefix}/runners/reset_registration_token", user) } shared_examples 'bad request' do |result| diff --git a/spec/requests/api/ci/runners_spec.rb b/spec/requests/api/ci/runners_spec.rb index dd9894f2972..fe57a574ceb 100644 --- a/spec/requests/api/ci/runners_spec.rb +++ b/spec/requests/api/ci/runners_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe API::Ci::Runners do +RSpec.describe API::Ci::Runners, feature_category: :runner do let_it_be(:admin) { create(:user, :admin) } let_it_be(:user) { create(:user) } let_it_be(:user2) { create(:user) } diff --git a/spec/requests/api/graphql/ci/runner_spec.rb b/spec/requests/api/graphql/ci/runner_spec.rb index 3cc572731ba..9015e14a830 100644 --- a/spec/requests/api/graphql/ci/runner_spec.rb +++ b/spec/requests/api/graphql/ci/runner_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'Query.runner(id)' do +RSpec.describe 'Query.runner(id)', feature_category: :runner do include GraphqlHelpers let_it_be(:user) { create(:user, :admin) } diff --git a/spec/requests/api/graphql/ci/runner_web_url_edge_spec.rb b/spec/requests/api/graphql/ci/runner_web_url_edge_spec.rb index 767e958ea82..9afa11a40b2 100644 --- a/spec/requests/api/graphql/ci/runner_web_url_edge_spec.rb +++ b/spec/requests/api/graphql/ci/runner_web_url_edge_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe 'RunnerWebUrlEdge' do +RSpec.describe 'RunnerWebUrlEdge', feature_category: :runner do include GraphqlHelpers describe 'inside a Query.group' do diff --git a/spec/requests/api/graphql/ci/runners_spec.rb b/spec/requests/api/graphql/ci/runners_spec.rb index 3054b866812..a114c82ef92 100644 --- a/spec/requests/api/graphql/ci/runners_spec.rb +++ b/spec/requests/api/graphql/ci/runners_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe 'Query.runners' do +RSpec.describe 'Query.runners', feature_category: :runner do include GraphqlHelpers let_it_be(:current_user) { create_default(:user, :admin) } diff --git a/spec/services/ci/runners/assign_runner_service_spec.rb b/spec/services/ci/runners/assign_runner_service_spec.rb index 08bb99830fb..030b54c2753 100644 --- a/spec/services/ci/runners/assign_runner_service_spec.rb +++ b/spec/services/ci/runners/assign_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::AssignRunnerService, '#execute' do +RSpec.describe ::Ci::Runners::AssignRunnerService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(runner, project, user).execute } let_it_be(:runner) { create(:ci_runner, :project, projects: [project]) } diff --git a/spec/services/ci/runners/bulk_delete_runners_service_spec.rb b/spec/services/ci/runners/bulk_delete_runners_service_spec.rb index fa8af1100df..dbdcda08282 100644 --- a/spec/services/ci/runners/bulk_delete_runners_service_spec.rb +++ b/spec/services/ci/runners/bulk_delete_runners_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::BulkDeleteRunnersService, '#execute' do +RSpec.describe ::Ci::Runners::BulkDeleteRunnersService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(**service_args).execute } let_it_be(:admin_user) { create(:user, :admin) } diff --git a/spec/services/ci/runners/process_runner_version_update_service_spec.rb b/spec/services/ci/runners/process_runner_version_update_service_spec.rb index b885138fc7a..1591782be11 100644 --- a/spec/services/ci/runners/process_runner_version_update_service_spec.rb +++ b/spec/services/ci/runners/process_runner_version_update_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::Runners::ProcessRunnerVersionUpdateService do +RSpec.describe Ci::Runners::ProcessRunnerVersionUpdateService, feature_category: :runner do subject(:service) { described_class.new(version) } let(:version) { '1.0.0' } diff --git a/spec/services/ci/runners/reconcile_existing_runner_versions_service_spec.rb b/spec/services/ci/runners/reconcile_existing_runner_versions_service_spec.rb index 1690190320a..1169e6f8106 100644 --- a/spec/services/ci/runners/reconcile_existing_runner_versions_service_spec.rb +++ b/spec/services/ci/runners/reconcile_existing_runner_versions_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::ReconcileExistingRunnerVersionsService, '#execute' do +RSpec.describe ::Ci::Runners::ReconcileExistingRunnerVersionsService, '#execute', feature_category: :runner do include RunnerReleasesHelper subject(:execute) { described_class.new.execute } diff --git a/spec/services/ci/runners/register_runner_service_spec.rb b/spec/services/ci/runners/register_runner_service_spec.rb index 2d1b109072f..6ec1cd11c89 100644 --- a/spec/services/ci/runners/register_runner_service_spec.rb +++ b/spec/services/ci/runners/register_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::RegisterRunnerService, '#execute' do +RSpec.describe ::Ci::Runners::RegisterRunnerService, '#execute', feature_category: :runner do let(:registration_token) { 'abcdefg123456' } let(:token) {} let(:args) { {} } diff --git a/spec/services/ci/runners/reset_registration_token_service_spec.rb b/spec/services/ci/runners/reset_registration_token_service_spec.rb index 79059712032..0563ea0d0cc 100644 --- a/spec/services/ci/runners/reset_registration_token_service_spec.rb +++ b/spec/services/ci/runners/reset_registration_token_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::ResetRegistrationTokenService, '#execute' do +RSpec.describe ::Ci::Runners::ResetRegistrationTokenService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(scope, current_user).execute } let_it_be(:user) { build(:user) } diff --git a/spec/services/ci/runners/set_runner_associated_projects_service_spec.rb b/spec/services/ci/runners/set_runner_associated_projects_service_spec.rb index e5cba80d567..66bd8cd9bd2 100644 --- a/spec/services/ci/runners/set_runner_associated_projects_service_spec.rb +++ b/spec/services/ci/runners/set_runner_associated_projects_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::SetRunnerAssociatedProjectsService, '#execute' do +RSpec.describe ::Ci::Runners::SetRunnerAssociatedProjectsService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(runner: runner, current_user: user, project_ids: project_ids).execute } let_it_be(:owner_project) { create(:project) } diff --git a/spec/services/ci/runners/unassign_runner_service_spec.rb b/spec/services/ci/runners/unassign_runner_service_spec.rb index cf710cf6893..36620ab9c57 100644 --- a/spec/services/ci/runners/unassign_runner_service_spec.rb +++ b/spec/services/ci/runners/unassign_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::UnassignRunnerService, '#execute' do +RSpec.describe ::Ci::Runners::UnassignRunnerService, '#execute', feature_category: :runner do let_it_be(:project) { create(:project) } let_it_be(:runner) { create(:ci_runner, :project, projects: [project]) } diff --git a/spec/services/ci/runners/unregister_runner_service_spec.rb b/spec/services/ci/runners/unregister_runner_service_spec.rb index 77fc299e4e1..33266bc58e5 100644 --- a/spec/services/ci/runners/unregister_runner_service_spec.rb +++ b/spec/services/ci/runners/unregister_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe ::Ci::Runners::UnregisterRunnerService, '#execute' do +RSpec.describe ::Ci::Runners::UnregisterRunnerService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(runner, 'some_token').execute } let(:runner) { create(:ci_runner) } diff --git a/spec/services/ci/runners/update_runner_service_spec.rb b/spec/services/ci/runners/update_runner_service_spec.rb index 1f953ac4cbb..42c509fee9e 100644 --- a/spec/services/ci/runners/update_runner_service_spec.rb +++ b/spec/services/ci/runners/update_runner_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::Runners::UpdateRunnerService, '#execute' do +RSpec.describe Ci::Runners::UpdateRunnerService, '#execute', feature_category: :runner do subject(:execute) { described_class.new(runner).execute(params) } let(:runner) { create(:ci_runner) } diff --git a/spec/support/database/query_recorder.rb b/spec/support/database/query_recorder.rb index 3480430a0da..1050120e528 100644 --- a/spec/support/database/query_recorder.rb +++ b/spec/support/database/query_recorder.rb @@ -3,7 +3,7 @@ RSpec.configure do |config| # Truncate the query_recorder log file before starting the suite config.before(:suite) do - log_file = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder.log_file) - File.write(log_file, '') if File.exist?(log_file) + log_path = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder::LOG_FILE) + File.write(log_path, '') if File.exist?(log_path) end end diff --git a/spec/views/shared/ssh_keys/_key_details.html.haml_spec.rb b/spec/views/shared/ssh_keys/_key_delete.html.haml_spec.rb index 1bee9f7463f..c9bdcabb4b6 100644 --- a/spec/views/shared/ssh_keys/_key_details.html.haml_spec.rb +++ b/spec/views/shared/ssh_keys/_key_delete.html.haml_spec.rb @@ -2,19 +2,21 @@ require 'spec_helper' RSpec.describe 'shared/ssh_keys/_key_delete.html.haml' do - context 'when the text parameter is used' do + context 'when the icon parameter is used' do it 'has text' do - render partial: 'shared/ssh_keys/key_delete', formats: :html, locals: { text: 'Button', html_class: '', button_data: '' } + render partial: 'shared/ssh_keys/key_delete', formats: :html, locals: { icon: true, button_data: '' } - expect(rendered).to have_button('Button') + expect(rendered).not_to have_button('Delete') + expect(rendered).to have_selector('[data-testid=remove-icon]') end end - context 'when the text parameter is not used' do + context 'when the icon parameter is not used' do it 'does not have text' do - render partial: 'shared/ssh_keys/key_delete', formats: :html, locals: { html_class: '', button_data: '' } + render partial: 'shared/ssh_keys/key_delete', formats: :html, locals: { button_data: '' } expect(rendered).to have_button('Delete') + expect(rendered).not_to have_selector('[data-testid=remove-icon]') end end end diff --git a/spec/workers/ci/runners/process_runner_version_update_worker_spec.rb b/spec/workers/ci/runners/process_runner_version_update_worker_spec.rb index ff67266c3e8..d6c31fe2016 100644 --- a/spec/workers/ci/runners/process_runner_version_update_worker_spec.rb +++ b/spec/workers/ci/runners/process_runner_version_update_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::Runners::ProcessRunnerVersionUpdateWorker do +RSpec.describe Ci::Runners::ProcessRunnerVersionUpdateWorker, feature_category: :runner do subject(:worker) { described_class.new } describe '#perform' do diff --git a/spec/workers/ci/runners/reconcile_existing_runner_versions_cron_worker_spec.rb b/spec/workers/ci/runners/reconcile_existing_runner_versions_cron_worker_spec.rb index 1292df62ce5..46145dc6c35 100644 --- a/spec/workers/ci/runners/reconcile_existing_runner_versions_cron_worker_spec.rb +++ b/spec/workers/ci/runners/reconcile_existing_runner_versions_cron_worker_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Ci::Runners::ReconcileExistingRunnerVersionsCronWorker do +RSpec.describe Ci::Runners::ReconcileExistingRunnerVersionsCronWorker, feature_category: :runner do subject(:worker) { described_class.new } describe '#perform' do |