diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-28 12:08:19 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-28 12:08:19 +0000 |
commit | 3fa33c82f9c49f4b53ddcf017fe77f1bff48a460 (patch) | |
tree | 6b0fb548b09370de722e06f47548c80380ff452d /spec/migrations | |
parent | dba63244c19187d32f1f998403555f1893f5abdb (diff) | |
download | gitlab-ce-3fa33c82f9c49f4b53ddcf017fe77f1bff48a460.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/migrations')
37 files changed, 159 insertions, 129 deletions
diff --git a/spec/migrations/20210918201050_remove_old_pending_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb b/spec/migrations/20210918201050_remove_old_pending_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb index b3d1b41c330..66b391d7fd5 100644 --- a/spec/migrations/20210918201050_remove_old_pending_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb +++ b/spec/migrations/20210918201050_remove_old_pending_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb @@ -22,7 +22,7 @@ def create_background_migration_jobs(ids, status, created_at) end RSpec.describe RemoveOldPendingJobsForRecalculateVulnerabilitiesOccurrencesUuid, :migration, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let!(:background_migration_jobs) { table(:background_migration_jobs) } let!(:before_target_date) { -Float::INFINITY..(DateTime.new(2021, 8, 17, 23, 59, 59)) } let!(:after_target_date) { (DateTime.new(2021, 8, 18, 0, 0, 0))..Float::INFINITY } diff --git a/spec/migrations/20211110151350_schedule_drop_invalid_security_findings_spec.rb b/spec/migrations/20211110151350_schedule_drop_invalid_security_findings_spec.rb index d05828112e6..3b27b1a1921 100644 --- a/spec/migrations/20211110151350_schedule_drop_invalid_security_findings_spec.rb +++ b/spec/migrations/20211110151350_schedule_drop_invalid_security_findings_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleDropInvalidSecurityFindings, :migration, :suppress_gitlab_schemas_validate_connection, schema: 20211108211434, - feature_category: :vulnerability_management do +RSpec.describe ScheduleDropInvalidSecurityFindings, :migration, :suppress_gitlab_schemas_validate_connection, + schema: 20211108211434, feature_category: :vulnerability_management do let!(:background_migration_jobs) { table(:background_migration_jobs) } let!(:namespace) { table(:namespaces).create!(name: 'user', path: 'user', type: Namespaces::UserNamespace.sti_name) } diff --git a/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb b/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb index 18513656029..745fcac8220 100644 --- a/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb +++ b/spec/migrations/20211116111644_schedule_remove_occurrence_pipelines_and_duplicate_vulnerabilities_findings_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe ScheduleRemoveOccurrencePipelinesAndDuplicateVulnerabilitiesFindings, - :suppress_gitlab_schemas_validate_connection, :migration, feature_category: :vulnerability_management do + :suppress_gitlab_schemas_validate_connection, :migration, feature_category: :vulnerability_management do let!(:background_migration_jobs) { table(:background_migration_jobs) } let!(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') } let!(:users) { table(:users) } diff --git a/spec/migrations/20211207125331_remove_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb b/spec/migrations/20211207125331_remove_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb index be89ee9d2aa..9fa2ac2313a 100644 --- a/spec/migrations/20211207125331_remove_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb +++ b/spec/migrations/20211207125331_remove_jobs_for_recalculate_vulnerabilities_occurrences_uuid_spec.rb @@ -21,7 +21,7 @@ def create_background_migration_jobs(ids, status, created_at) end RSpec.describe RemoveJobsForRecalculateVulnerabilitiesOccurrencesUuid, :migration, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let!(:background_migration_jobs) { table(:background_migration_jobs) } context 'when RecalculateVulnerabilitiesOccurrencesUuid jobs are present' do diff --git a/spec/migrations/20220124130028_dedup_runner_projects_spec.rb b/spec/migrations/20220124130028_dedup_runner_projects_spec.rb index ee468f40908..b9189cbae7f 100644 --- a/spec/migrations/20220124130028_dedup_runner_projects_spec.rb +++ b/spec/migrations/20220124130028_dedup_runner_projects_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe DedupRunnerProjects, :migration, :suppress_gitlab_schemas_validate_connection, -schema: 20220120085655, feature_category: :runner do + schema: 20220120085655, feature_category: :runner do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:runners) { table(:ci_runners) } diff --git a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb index ea88cf1a2ce..3abe173196f 100644 --- a/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb +++ b/spec/migrations/20220128155251_remove_dangling_running_builds_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration!('remove_dangling_running_builds') RSpec.describe RemoveDanglingRunningBuilds, :suppress_gitlab_schemas_validate_connection, -feature_category: :continuous_integration do + feature_category: :continuous_integration do let(:namespace) { table(:namespaces).create!(name: 'user', path: 'user') } let(:project) { table(:projects).create!(namespace_id: namespace.id) } let(:runner) { table(:ci_runners).create!(runner_type: 1) } diff --git a/spec/migrations/20220307192610_remove_duplicate_project_tag_releases_spec.rb b/spec/migrations/20220307192610_remove_duplicate_project_tag_releases_spec.rb index 3bdd6e5fab9..98e2ba4816b 100644 --- a/spec/migrations/20220307192610_remove_duplicate_project_tag_releases_spec.rb +++ b/spec/migrations/20220307192610_remove_duplicate_project_tag_releases_spec.rb @@ -14,9 +14,7 @@ RSpec.describe RemoveDuplicateProjectTagReleases, feature_category: :release_orc let(:dup_releases) do Array.new(4).fill do |i| - rel = releases.new(project_id: project.id, - tag: "duplicate tag", - released_at: (DateTime.now + i.days)) + rel = releases.new(project_id: project.id, tag: "duplicate tag", released_at: (DateTime.now + i.days)) rel.save!(validate: false) rel end diff --git a/spec/migrations/20220310141349_remove_dependency_list_usage_data_from_redis_spec.rb b/spec/migrations/20220310141349_remove_dependency_list_usage_data_from_redis_spec.rb index f40f9c70833..5d9be79e768 100644 --- a/spec/migrations/20220310141349_remove_dependency_list_usage_data_from_redis_spec.rb +++ b/spec/migrations/20220310141349_remove_dependency_list_usage_data_from_redis_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe RemoveDependencyListUsageDataFromRedis, :migration, :clean_gitlab_redis_shared_state, -feature_category: :dependency_management do + feature_category: :dependency_management do let(:key) { "DEPENDENCY_LIST_USAGE_COUNTER" } describe "#up" do diff --git a/spec/migrations/20220324032250_migrate_shimo_confluence_service_category_spec.rb b/spec/migrations/20220324032250_migrate_shimo_confluence_service_category_spec.rb index 15c16a2b232..6f9e70aa8c8 100644 --- a/spec/migrations/20220324032250_migrate_shimo_confluence_service_category_spec.rb +++ b/spec/migrations/20220324032250_migrate_shimo_confluence_service_category_spec.rb @@ -11,8 +11,9 @@ RSpec.describe MigrateShimoConfluenceServiceCategory, :migration, feature_catego before do namespace = namespaces.create!(name: 'test', path: 'test') projects.create!(id: 1, namespace_id: namespace.id, name: 'gitlab', path: 'gitlab') - integrations.create!(id: 1, active: true, type_new: "Integrations::SlackSlashCommands", - category: 'chat', project_id: 1) + integrations.create!( + id: 1, active: true, type_new: "Integrations::SlackSlashCommands", category: 'chat', project_id: 1 + ) integrations.create!(id: 3, active: true, type_new: "Integrations::Confluence", category: 'common', project_id: 1) integrations.create!(id: 5, active: true, type_new: "Integrations::Shimo", category: 'common', project_id: 1) end diff --git a/spec/migrations/20220505044348_fix_automatic_iterations_cadences_start_date_spec.rb b/spec/migrations/20220505044348_fix_automatic_iterations_cadences_start_date_spec.rb index 3a6a8f5dbe5..16258eeb0fb 100644 --- a/spec/migrations/20220505044348_fix_automatic_iterations_cadences_start_date_spec.rb +++ b/spec/migrations/20220505044348_fix_automatic_iterations_cadences_start_date_spec.rb @@ -28,19 +28,19 @@ RSpec.describe FixAutomaticIterationsCadencesStartDate, feature_category: :team_ before do sprints.create!(id: 2, start_date: jan2022, due_date: jan2022 + 1.week, iterations_cadence_id: cadence1.id, - group_id: group1.id, iid: 1) + group_id: group1.id, iid: 1) sprints.create!(id: 1, start_date: dec2022, due_date: dec2022 + 1.week, iterations_cadence_id: cadence1.id, - group_id: group1.id, iid: 2) + group_id: group1.id, iid: 2) sprints.create!(id: 4, start_date: feb2022, due_date: feb2022 + 1.week, iterations_cadence_id: cadence3.id, - group_id: group2.id, iid: 1) + group_id: group2.id, iid: 1) sprints.create!(id: 3, start_date: may2022, due_date: may2022 + 1.week, iterations_cadence_id: cadence3.id, - group_id: group2.id, iid: 2) + group_id: group2.id, iid: 2) sprints.create!(id: 5, start_date: may2022, due_date: may2022 + 1.week, iterations_cadence_id: cadence4.id, - group_id: group2.id, iid: 4) + group_id: group2.id, iid: 4) sprints.create!(id: 6, start_date: feb2022, due_date: feb2022 + 1.week, iterations_cadence_id: cadence4.id, - group_id: group2.id, iid: 3) + group_id: group2.id, iid: 3) end describe '#up' do diff --git a/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb b/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb index 2eff65d5873..c01d982c34e 100644 --- a/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb +++ b/spec/migrations/20220601152916_add_user_id_and_ip_address_success_index_to_authentication_events_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe AddUserIdAndIpAddressSuccessIndexToAuthenticationEvents, -feature_category: :system_access do + feature_category: :system_access do let(:db) { described_class.new } let(:old_index) { described_class::OLD_INDEX_NAME } let(:new_index) { described_class::NEW_INDEX_NAME } diff --git a/spec/migrations/20220606082910_add_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb b/spec/migrations/20220606082910_add_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb index b74e15d804f..4ae40933541 100644 --- a/spec/migrations/20220606082910_add_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb +++ b/spec/migrations/20220606082910_add_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb @@ -5,7 +5,7 @@ require "spec_helper" require_migration! RSpec.describe AddTmpIndexForPotentiallyMisassociatedVulnerabilityOccurrences, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let(:async_index) { Gitlab::Database::AsyncIndexes::PostgresAsyncIndex } let(:index_name) { described_class::INDEX_NAME } diff --git a/spec/migrations/20220607082910_add_sync_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb b/spec/migrations/20220607082910_add_sync_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb index 8d3ef9a46d7..d4a800eb1db 100644 --- a/spec/migrations/20220607082910_add_sync_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb +++ b/spec/migrations/20220607082910_add_sync_tmp_index_for_potentially_misassociated_vulnerability_occurrences_spec.rb @@ -5,7 +5,7 @@ require "spec_helper" require_migration! RSpec.describe AddSyncTmpIndexForPotentiallyMisassociatedVulnerabilityOccurrences, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let(:table) { "vulnerability_occurrences" } let(:index) { described_class::INDEX_NAME } diff --git a/spec/migrations/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects_spec.rb b/spec/migrations/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects_spec.rb index f8f1565fe4c..a9f0bdc8487 100644 --- a/spec/migrations/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects_spec.rb +++ b/spec/migrations/20220801155858_schedule_disable_legacy_open_source_licence_for_recent_public_projects_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleDisableLegacyOpenSourceLicenceForRecentPublicProjects, schema: 20220801155858, - feature_category: :projects do +RSpec.describe ScheduleDisableLegacyOpenSourceLicenceForRecentPublicProjects, + schema: 20220801155858, feature_category: :projects do context 'when on gitlab.com' do let(:background_migration) { described_class::MIGRATION } let(:migration) { described_class.new } diff --git a/spec/migrations/20220816163444_update_start_date_for_iterations_cadences_spec.rb b/spec/migrations/20220816163444_update_start_date_for_iterations_cadences_spec.rb index 25b2b5c2e18..0807f5d4e38 100644 --- a/spec/migrations/20220816163444_update_start_date_for_iterations_cadences_spec.rb +++ b/spec/migrations/20220816163444_update_start_date_for_iterations_cadences_spec.rb @@ -31,31 +31,31 @@ RSpec.describe UpdateStartDateForIterationsCadences, :freeze_time, feature_categ before do # Past iteratioin sprints.create!(id: 1, iid: 1, **cadence_params(auto_cadence1), - start_date: Date.current - 1.week, due_date: Date.current - 1.day) + start_date: Date.current - 1.week, due_date: Date.current - 1.day) # Current iteraition sprints.create!(id: 3, iid: 5, **cadence_params(auto_cadence1), - start_date: Date.current, due_date: Date.current + 1.week) + start_date: Date.current, due_date: Date.current + 1.week) # First upcoming iteration sprints.create!(id: 4, iid: 8, **cadence_params(auto_cadence1), - start_date: first_upcoming_start_date, due_date: first_upcoming_start_date + 1.week) + start_date: first_upcoming_start_date, due_date: first_upcoming_start_date + 1.week) # Second upcoming iteration sprints.create!(id: 5, iid: 9, **cadence_params(auto_cadence1), - start_date: first_upcoming_start_date + 2.weeks, due_date: first_upcoming_start_date + 3.weeks) + start_date: first_upcoming_start_date + 2.weeks, due_date: first_upcoming_start_date + 3.weeks) sprints.create!(id: 6, iid: 1, **cadence_params(manual_cadence2), - start_date: Date.current, due_date: Date.current + 1.week) + start_date: Date.current, due_date: Date.current + 1.week) sprints.create!(id: 7, iid: 5, **cadence_params(manual_cadence2), - start_date: Date.current + 2.weeks, due_date: Date.current + 3.weeks) + start_date: Date.current + 2.weeks, due_date: Date.current + 3.weeks) end describe '#up' do it "updates the start date of an automatic cadence to the start date of its first upcoming sprint record." do expect { migration.up } - .to change { auto_cadence1.reload.start_date }.to(first_upcoming_start_date) - .and not_change { auto_cadence2.reload.start_date } # the cadence doesn't have any upcoming iteration. - .and not_change { auto_cadence3.reload.start_date } # the cadence is empty; it has no iterations. - .and not_change { manual_cadence1.reload.start_date } # manual cadence don't need to be touched. - .and not_change { manual_cadence2.reload.start_date } # manual cadence don't need to be touched. + .to change { auto_cadence1.reload.start_date }.to(first_upcoming_start_date) + .and not_change { auto_cadence2.reload.start_date } # the cadence doesn't have any upcoming iteration. + .and not_change { auto_cadence3.reload.start_date } # the cadence is empty; it has no iterations. + .and not_change { manual_cadence1.reload.start_date } # manual cadence don't need to be touched. + .and not_change { manual_cadence2.reload.start_date } # manual cadence don't need to be touched. end end @@ -64,10 +64,10 @@ RSpec.describe UpdateStartDateForIterationsCadences, :freeze_time, feature_categ migration.up expect { migration.down } - .to change { auto_cadence1.reload.start_date }.to(original_cadence_start_date) - .and not_change { auto_cadence2.reload.start_date } # the cadence is empty; it has no iterations. - .and not_change { manual_cadence1.reload.start_date } # manual cadence don't need to be touched. - .and not_change { manual_cadence2.reload.start_date } # manual cadence don't need to be touched. + .to change { auto_cadence1.reload.start_date }.to(original_cadence_start_date) + .and not_change { auto_cadence2.reload.start_date } # the cadence is empty; it has no iterations. + .and not_change { manual_cadence1.reload.start_date } # manual cadence don't need to be touched. + .and not_change { manual_cadence2.reload.start_date } # manual cadence don't need to be touched. end end end diff --git a/spec/migrations/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions_spec.rb b/spec/migrations/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions_spec.rb index 5a61f49485c..1d18862c8ee 100644 --- a/spec/migrations/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions_spec.rb +++ b/spec/migrations/20220819153725_add_vulnerability_advisory_foreign_key_to_sbom_vulnerable_component_versions_spec.rb @@ -5,7 +5,7 @@ require "spec_helper" require_migration! RSpec.describe AddVulnerabilityAdvisoryForeignKeyToSbomVulnerableComponentVersions, -feature_category: :dependency_management do + feature_category: :dependency_management do let(:table) { described_class::SOURCE_TABLE } let(:column) { described_class::COLUMN } let(:foreign_key) { -> { described_class.new.foreign_keys_for(table, column).first } } diff --git a/spec/migrations/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions_spec.rb b/spec/migrations/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions_spec.rb index 999c833f9e3..a280795380d 100644 --- a/spec/migrations/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions_spec.rb +++ b/spec/migrations/20220819162852_add_sbom_component_version_foreign_key_to_sbom_vulnerable_component_versions_spec.rb @@ -5,7 +5,7 @@ require "spec_helper" require_migration! RSpec.describe AddSbomComponentVersionForeignKeyToSbomVulnerableComponentVersions, -feature_category: :dependency_management do + feature_category: :dependency_management do let(:table) { described_class::SOURCE_TABLE } let(:column) { described_class::COLUMN } let(:foreign_key) { -> { described_class.new.foreign_keys_for(table, column).first } } diff --git a/spec/migrations/20220921144258_remove_orphan_group_token_users_spec.rb b/spec/migrations/20220921144258_remove_orphan_group_token_users_spec.rb index 7b0df403e30..5cfcb2eb3dd 100644 --- a/spec/migrations/20220921144258_remove_orphan_group_token_users_spec.rb +++ b/spec/migrations/20220921144258_remove_orphan_group_token_users_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' require_migration! RSpec.describe RemoveOrphanGroupTokenUsers, :migration, :sidekiq_inline, -feature_category: :system_access do + feature_category: :system_access do subject(:migration) { described_class.new } let(:users) { table(:users) } @@ -18,12 +18,14 @@ feature_category: :system_access do let!(:valid_used_bot) do create_bot(username: 'used_bot', email: 'used_bot@bot.com').tap do |bot| group = namespaces.create!(type: 'Group', path: 'used_bot_group', name: 'used_bot_group') - members.create!(user_id: bot.id, - source_id: group.id, - member_namespace_id: group.id, - source_type: 'Group', - access_level: 10, - notification_level: 0) + members.create!( + user_id: bot.id, + source_id: group.id, + member_namespace_id: group.id, + source_type: 'Group', + access_level: 10, + notification_level: 0 + ) end end diff --git a/spec/migrations/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status_spec.rb b/spec/migrations/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status_spec.rb index 5c1b5c8f2a7..085e9726663 100644 --- a/spec/migrations/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status_spec.rb +++ b/spec/migrations/20220928225711_schedule_update_ci_pipeline_artifacts_locked_status_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleUpdateCiPipelineArtifactsLockedStatus, migration: :gitlab_ci, - feature_category: :build_artifacts do +RSpec.describe ScheduleUpdateCiPipelineArtifactsLockedStatus, + migration: :gitlab_ci, feature_category: :build_artifacts do let!(:migration) { described_class::MIGRATION } describe '#up' do diff --git a/spec/migrations/20221018050323_add_objective_and_keyresult_to_work_item_types_spec.rb b/spec/migrations/20221018050323_add_objective_and_keyresult_to_work_item_types_spec.rb index 6284608becb..d591b370d65 100644 --- a/spec/migrations/20221018050323_add_objective_and_keyresult_to_work_item_types_spec.rb +++ b/spec/migrations/20221018050323_add_objective_and_keyresult_to_work_item_types_spec.rb @@ -28,10 +28,12 @@ RSpec.describe AddObjectiveAndKeyresultToWorkItemTypes, :migration, feature_cate it 'skips creating both objective & keyresult type record if it already exists' do reset_db_state_prior_to_migration - work_item_types.find_or_create_by!(name: 'Key Result', namespace_id: nil, base_type: base_types[:key_result], - icon_name: 'issue-type-keyresult') - work_item_types.find_or_create_by!(name: 'Objective', namespace_id: nil, base_type: base_types[:objective], - icon_name: 'issue-type-objective') + work_item_types.find_or_create_by!( + name: 'Key Result', namespace_id: nil, base_type: base_types[:key_result], icon_name: 'issue-type-keyresult' + ) + work_item_types.find_or_create_by!( + name: 'Objective', namespace_id: nil, base_type: base_types[:objective], icon_name: 'issue-type-objective' + ) expect do migrate! @@ -52,15 +54,20 @@ RSpec.describe AddObjectiveAndKeyresultToWorkItemTypes, :migration, feature_cate def reset_db_state_prior_to_migration # Database needs to be in a similar state as when this migration was created work_item_types.delete_all - work_item_types.find_or_create_by!(name: 'Issue', namespace_id: nil, base_type: base_types[:issue], - icon_name: 'issue-type-issue') - work_item_types.find_or_create_by!(name: 'Incident', namespace_id: nil, base_type: base_types[:incident], - icon_name: 'issue-type-incident') - work_item_types.find_or_create_by!(name: 'Test Case', namespace_id: nil, base_type: base_types[:test_case], - icon_name: 'issue-type-test-case') - work_item_types.find_or_create_by!(name: 'Requirement', namespace_id: nil, base_type: base_types[:requirement], - icon_name: 'issue-type-requirements') - work_item_types.find_or_create_by!(name: 'Task', namespace_id: nil, base_type: base_types[:task], - icon_name: 'issue-type-task') + work_item_types.find_or_create_by!( + name: 'Issue', namespace_id: nil, base_type: base_types[:issue], icon_name: 'issue-type-issue' + ) + work_item_types.find_or_create_by!( + name: 'Incident', namespace_id: nil, base_type: base_types[:incident], icon_name: 'issue-type-incident' + ) + work_item_types.find_or_create_by!( + name: 'Test Case', namespace_id: nil, base_type: base_types[:test_case], icon_name: 'issue-type-test-case' + ) + work_item_types.find_or_create_by!( + name: 'Requirement', namespace_id: nil, base_type: base_types[:requirement], icon_name: 'issue-type-requirements' + ) + work_item_types.find_or_create_by!( + name: 'Task', namespace_id: nil, base_type: base_types[:task], icon_name: 'issue-type-task' + ) end end diff --git a/spec/migrations/20221215151822_schedule_backfill_releases_author_id_spec.rb b/spec/migrations/20221215151822_schedule_backfill_releases_author_id_spec.rb index d7aa53ec35b..7cc0bd96a0d 100644 --- a/spec/migrations/20221215151822_schedule_backfill_releases_author_id_spec.rb +++ b/spec/migrations/20221215151822_schedule_backfill_releases_author_id_spec.rb @@ -10,21 +10,27 @@ RSpec.describe ScheduleBackfillReleasesAuthorId, feature_category: :release_orch let(:date_time) { DateTime.now } let!(:batched_migration) { described_class::MIGRATION } let!(:test_user) do - user_table.create!(name: 'test', - email: 'test@example.com', - username: 'test', - projects_limit: 10) + user_table.create!( + name: 'test', + email: 'test@example.com', + username: 'test', + projects_limit: 10 + ) end before do - releases_table.create!(tag: 'tag1', name: 'tag1', - released_at: (date_time - 1.minute), author_id: test_user.id) - releases_table.create!(tag: 'tag2', name: 'tag2', - released_at: (date_time - 2.minutes), author_id: test_user.id) - releases_table.new(tag: 'tag3', name: 'tag3', - released_at: (date_time - 3.minutes), author_id: nil).save!(validate: false) - releases_table.new(tag: 'tag4', name: 'tag4', - released_at: (date_time - 4.minutes), author_id: nil).save!(validate: false) + releases_table.create!( + tag: 'tag1', name: 'tag1', released_at: (date_time - 1.minute), author_id: test_user.id + ) + releases_table.create!( + tag: 'tag2', name: 'tag2', released_at: (date_time - 2.minutes), author_id: test_user.id + ) + releases_table.new( + tag: 'tag3', name: 'tag3', released_at: (date_time - 3.minutes), author_id: nil + ).save!(validate: false) + releases_table.new( + tag: 'tag4', name: 'tag4', released_at: (date_time - 4.minutes), author_id: nil + ).save!(validate: false) end it 'schedules a new batched migration' do diff --git a/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb b/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb index 6f9cfe4764a..1b6899b5b30 100644 --- a/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb +++ b/spec/migrations/20221221110733_remove_temp_index_for_project_statistics_upload_size_migration_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe RemoveTempIndexForProjectStatisticsUploadSizeMigration, -feature_category: :subscription_cost_management do + feature_category: :subscription_cost_management do let(:table_name) { 'project_statistics' } let(:index_name) { described_class::INDEX_NAME } diff --git a/spec/migrations/20230105172120_sync_new_amount_used_with_amount_used_on_ci_namespace_monthly_usages_table_spec.rb b/spec/migrations/20230105172120_sync_new_amount_used_with_amount_used_on_ci_namespace_monthly_usages_table_spec.rb index aa82ca2661b..70c9c1333b8 100644 --- a/spec/migrations/20230105172120_sync_new_amount_used_with_amount_used_on_ci_namespace_monthly_usages_table_spec.rb +++ b/spec/migrations/20230105172120_sync_new_amount_used_with_amount_used_on_ci_namespace_monthly_usages_table_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' require_migration! RSpec.describe SyncNewAmountUsedWithAmountUsedOnCiNamespaceMonthlyUsagesTable, migration: :gitlab_ci, -feature_category: :continuous_integration do + feature_category: :continuous_integration do let(:namespace_usages) { table(:ci_namespace_monthly_usages) } let(:migration) { described_class.new } diff --git a/spec/migrations/cleanup_backfill_integrations_enable_ssl_verification_spec.rb b/spec/migrations/cleanup_backfill_integrations_enable_ssl_verification_spec.rb index 5854dcd3cb0..01c85f85e0b 100644 --- a/spec/migrations/cleanup_backfill_integrations_enable_ssl_verification_spec.rb +++ b/spec/migrations/cleanup_backfill_integrations_enable_ssl_verification_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe CleanupBackfillIntegrationsEnableSslVerification, :migration, -feature_category: :system_access do + feature_category: :system_access do let(:job_class_name) { 'BackfillIntegrationsEnableSslVerification' } before do diff --git a/spec/migrations/cleanup_vulnerability_state_transitions_with_same_from_state_to_state_spec.rb b/spec/migrations/cleanup_vulnerability_state_transitions_with_same_from_state_to_state_spec.rb index b808f03428d..b270f2b100f 100644 --- a/spec/migrations/cleanup_vulnerability_state_transitions_with_same_from_state_to_state_spec.rb +++ b/spec/migrations/cleanup_vulnerability_state_transitions_with_same_from_state_to_state_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe CleanupVulnerabilityStateTransitionsWithSameFromStateToState, :migration, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let!(:namespace) { table(:namespaces).create!(name: 'namespace', type: 'Group', path: 'namespace') } let!(:user) { table(:users).create!(email: 'author@example.com', username: 'author', projects_limit: 10) } let!(:project) do diff --git a/spec/migrations/delete_migrate_shared_vulnerability_scanners_spec.rb b/spec/migrations/delete_migrate_shared_vulnerability_scanners_spec.rb index 562b1e25db4..8a0c0250cdf 100644 --- a/spec/migrations/delete_migrate_shared_vulnerability_scanners_spec.rb +++ b/spec/migrations/delete_migrate_shared_vulnerability_scanners_spec.rb @@ -9,37 +9,41 @@ RSpec.describe DeleteMigrateSharedVulnerabilityScanners, :migration, feature_cat let(:batched_background_migration_jobs) { table(:batched_background_migration_jobs) } let(:migration) do - batched_background_migrations.create!(created_at: Time.zone.now, - updated_at: Time.zone.now, - min_value: 1, - max_value: 1, - batch_size: described_class::BATCH_SIZE, - sub_batch_size: 100, - interval: 300, - status: 3, - job_class_name: described_class::MIGRATION, - batch_class_name: "PrimaryKeyBatchingStrategy", - table_name: described_class::TABLE_NAME, - column_name: described_class::BATCH_COLUMN, - job_arguments: [], - pause_ms: 100, - max_batch_size: 1000, - gitlab_schema: "gitlab_main") + batched_background_migrations.create!( + created_at: Time.zone.now, + updated_at: Time.zone.now, + min_value: 1, + max_value: 1, + batch_size: described_class::BATCH_SIZE, + sub_batch_size: 100, + interval: 300, + status: 3, + job_class_name: described_class::MIGRATION, + batch_class_name: "PrimaryKeyBatchingStrategy", + table_name: described_class::TABLE_NAME, + column_name: described_class::BATCH_COLUMN, + job_arguments: [], + pause_ms: 100, + max_batch_size: 1000, + gitlab_schema: "gitlab_main" + ) end let(:jobs) do Array.new(10) do - batched_background_migration_jobs.create!(batched_background_migration_id: migration.id, - created_at: Time.zone.now, - updated_at: Time.zone.now, - min_value: 1, - max_value: 1, - batch_size: 1, - sub_batch_size: 1, - status: 0, - attempts: 0, - metrics: {}, - pause_ms: 100) + batched_background_migration_jobs.create!( + batched_background_migration_id: migration.id, + created_at: Time.zone.now, + updated_at: Time.zone.now, + min_value: 1, + max_value: 1, + batch_size: 1, + sub_batch_size: 1, + status: 0, + attempts: 0, + metrics: {}, + pause_ms: 100 + ) end end diff --git a/spec/migrations/schedule_backfill_draft_status_on_merge_requests_corrected_regex_spec.rb b/spec/migrations/schedule_backfill_draft_status_on_merge_requests_corrected_regex_spec.rb index a3bec40c3f0..abcdde7f075 100644 --- a/spec/migrations/schedule_backfill_draft_status_on_merge_requests_corrected_regex_spec.rb +++ b/spec/migrations/schedule_backfill_draft_status_on_merge_requests_corrected_regex_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' require_migration! RSpec.describe ScheduleBackfillDraftStatusOnMergeRequestsCorrectedRegex, - :sidekiq, feature_category: :code_review_workflow do + :sidekiq, feature_category: :code_review_workflow do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:merge_requests) { table(:merge_requests) } diff --git a/spec/migrations/schedule_fixing_security_scan_statuses_spec.rb b/spec/migrations/schedule_fixing_security_scan_statuses_spec.rb index c4c7819bda7..56d30e71676 100644 --- a/spec/migrations/schedule_fixing_security_scan_statuses_spec.rb +++ b/spec/migrations/schedule_fixing_security_scan_statuses_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' require_migration! -RSpec.describe ScheduleFixingSecurityScanStatuses, :suppress_gitlab_schemas_validate_connection, - feature_category: :vulnerability_management do +RSpec.describe ScheduleFixingSecurityScanStatuses, + :suppress_gitlab_schemas_validate_connection, feature_category: :vulnerability_management do let!(:namespaces) { table(:namespaces) } let!(:projects) { table(:projects) } let!(:pipelines) { table(:ci_pipelines) } diff --git a/spec/migrations/schedule_purging_stale_security_scans_spec.rb b/spec/migrations/schedule_purging_stale_security_scans_spec.rb index b39baa145ff..906dc90bcc4 100644 --- a/spec/migrations/schedule_purging_stale_security_scans_spec.rb +++ b/spec/migrations/schedule_purging_stale_security_scans_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe SchedulePurgingStaleSecurityScans, :suppress_gitlab_schemas_validate_connection, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do let!(:namespaces) { table(:namespaces) } let!(:projects) { table(:projects) } let!(:pipelines) { table(:ci_pipelines) } diff --git a/spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb b/spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb index a238ab70c30..602a157fffb 100644 --- a/spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb +++ b/spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe ScheduleRecalculateVulnerabilityFindingSignaturesForFindings, :migration, -feature_category: :vulnerability_management do + feature_category: :vulnerability_management do before do allow(Gitlab).to receive(:ee?).and_return(ee?) stub_const("#{described_class.name}::BATCH_SIZE", 2) @@ -36,11 +36,13 @@ feature_category: :vulnerability_management do end let!(:identifier) do - identifiers.create!(project_id: project.id, - fingerprint: 'd432c2ad2953e8bd587a3a43b3ce309b5b0154c123', - external_type: 'SECURITY_ID', - external_id: 'SECURITY_0', - name: 'SECURITY_IDENTIFIER 0') + identifiers.create!( + project_id: project.id, + fingerprint: 'd432c2ad2953e8bd587a3a43b3ce309b5b0154c123', + external_type: 'SECURITY_ID', + external_id: 'SECURITY_0', + name: 'SECURITY_IDENTIFIER 0' + ) end let!(:finding1) { findings.create!(finding_params) } diff --git a/spec/migrations/set_email_confirmation_setting_before_removing_send_user_confirmation_email_column_spec.rb b/spec/migrations/set_email_confirmation_setting_before_removing_send_user_confirmation_email_column_spec.rb index 8e00fbe4b89..02ecbe90ee0 100644 --- a/spec/migrations/set_email_confirmation_setting_before_removing_send_user_confirmation_email_column_spec.rb +++ b/spec/migrations/set_email_confirmation_setting_before_removing_send_user_confirmation_email_column_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe SetEmailConfirmationSettingBeforeRemovingSendUserConfirmationEmailColumn, - feature_category: :user_profile do + feature_category: :user_profile do let(:migration) { described_class.new } let(:application_settings_table) { table(:application_settings) } diff --git a/spec/migrations/start_backfill_ci_queuing_tables_spec.rb b/spec/migrations/start_backfill_ci_queuing_tables_spec.rb index c308a16d5b8..0a189b58c94 100644 --- a/spec/migrations/start_backfill_ci_queuing_tables_spec.rb +++ b/spec/migrations/start_backfill_ci_queuing_tables_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe StartBackfillCiQueuingTables, :suppress_gitlab_schemas_validate_connection, -feature_category: :continuous_integration do + feature_category: :continuous_integration do let(:namespaces) { table(:namespaces) } let(:projects) { table(:projects) } let(:builds) { table(:ci_builds) } diff --git a/spec/migrations/sync_new_amount_used_for_ci_namespace_monthly_usages_spec.rb b/spec/migrations/sync_new_amount_used_for_ci_namespace_monthly_usages_spec.rb index da8790f4450..c60447d04a1 100644 --- a/spec/migrations/sync_new_amount_used_for_ci_namespace_monthly_usages_spec.rb +++ b/spec/migrations/sync_new_amount_used_for_ci_namespace_monthly_usages_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' require_migration! RSpec.describe SyncNewAmountUsedForCiNamespaceMonthlyUsages, migration: :gitlab_ci, - feature_category: :continuous_integration do + feature_category: :continuous_integration do let(:namespace_usages) { table(:ci_namespace_monthly_usages) } before do diff --git a/spec/migrations/sync_new_amount_used_for_ci_project_monthly_usages_spec.rb b/spec/migrations/sync_new_amount_used_for_ci_project_monthly_usages_spec.rb index 1c9b2711687..d7add66a97f 100644 --- a/spec/migrations/sync_new_amount_used_for_ci_project_monthly_usages_spec.rb +++ b/spec/migrations/sync_new_amount_used_for_ci_project_monthly_usages_spec.rb @@ -5,7 +5,7 @@ require 'spec_helper' require_migration! RSpec.describe SyncNewAmountUsedForCiProjectMonthlyUsages, migration: :gitlab_ci, - feature_category: :continuous_integration do + feature_category: :continuous_integration do let(:project_usages) { table(:ci_project_monthly_usages) } before do diff --git a/spec/migrations/update_application_settings_container_registry_exp_pol_worker_capacity_default_spec.rb b/spec/migrations/update_application_settings_container_registry_exp_pol_worker_capacity_default_spec.rb index d249fcecf66..66da9e6653d 100644 --- a/spec/migrations/update_application_settings_container_registry_exp_pol_worker_capacity_default_spec.rb +++ b/spec/migrations/update_application_settings_container_registry_exp_pol_worker_capacity_default_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe UpdateApplicationSettingsContainerRegistryExpPolWorkerCapacityDefault, -feature_category: :container_registry do + feature_category: :container_registry do let(:settings) { table(:application_settings) } context 'with no rows in the application_settings table' do diff --git a/spec/migrations/update_application_settings_protected_paths_spec.rb b/spec/migrations/update_application_settings_protected_paths_spec.rb index 055955c56f1..c2bd4e8727d 100644 --- a/spec/migrations/update_application_settings_protected_paths_spec.rb +++ b/spec/migrations/update_application_settings_protected_paths_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' require_migration! RSpec.describe UpdateApplicationSettingsProtectedPaths, :aggregate_failures, -feature_category: :system_access do + feature_category: :system_access do subject(:migration) { described_class.new } let!(:application_settings) { table(:application_settings) } diff --git a/spec/migrations/update_default_scan_method_of_dast_site_profile_spec.rb b/spec/migrations/update_default_scan_method_of_dast_site_profile_spec.rb index ac7a4171063..15a8e79a610 100644 --- a/spec/migrations/update_default_scan_method_of_dast_site_profile_spec.rb +++ b/spec/migrations/update_default_scan_method_of_dast_site_profile_spec.rb @@ -14,13 +14,23 @@ RSpec.describe UpdateDefaultScanMethodOfDastSiteProfile, feature_category: :dyna project = projects.create!(id: 12, namespace_id: namespace.id, name: 'gitlab', path: 'gitlab') dast_site = dast_sites.create!(id: 1, url: 'https://www.gitlab.com', project_id: project.id) - dast_site_profiles.create!(id: 1, project_id: project.id, dast_site_id: dast_site.id, - name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - 0", - scan_method: 0, target_type: 0) + dast_site_profiles.create!( + id: 1, + project_id: project.id, + dast_site_id: dast_site.id, + name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - 0", + scan_method: 0, + target_type: 0 + ) - dast_site_profiles.create!(id: 2, project_id: project.id, dast_site_id: dast_site.id, - name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - 1", - scan_method: 0, target_type: 1) + dast_site_profiles.create!( + id: 2, + project_id: project.id, + dast_site_id: dast_site.id, + name: "#{FFaker::Product.product_name.truncate(192)} #{SecureRandom.hex(4)} - 1", + scan_method: 0, + target_type: 1 + ) end it 'updates the scan_method to 1 for profiles with target_type 1' do |