diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-05 06:08:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-05 06:08:14 +0300 |
commit | fdb5a6d73c634c2545cd2cb70cdc0a3b1458c712 (patch) | |
tree | 53443e41b232b4aa7ec000e265df5dd2152b94cf /spec | |
parent | f11cce04caba6363b1e8d33989e5671819d1d502 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
17 files changed, 92 insertions, 154 deletions
diff --git a/spec/components/pajamas/banner_component_spec.rb b/spec/components/pajamas/banner_component_spec.rb index c9d9a9176e8..47dc9042913 100644 --- a/spec/components/pajamas/banner_component_spec.rb +++ b/spec/components/pajamas/banner_component_spec.rb @@ -80,8 +80,8 @@ RSpec.describe Pajamas::BannerComponent, type: :component do describe 'variant' do context 'by default (promotion)' do - it 'applies no variant class' do - expect(page).to have_css "[class='gl-banner']" + it 'does not apply introduction class' do + expect(page).not_to have_css ".gl-banner-introduction" end end @@ -89,7 +89,7 @@ RSpec.describe Pajamas::BannerComponent, type: :component do let(:options) { { variant: :introduction } } it "applies the introduction class to the banner" do - expect(page).to have_css ".gl-banner.gl-banner-introduction" + expect(page).to have_css ".gl-banner-introduction" end it "applies the confirm class to the close button" do @@ -101,7 +101,7 @@ RSpec.describe Pajamas::BannerComponent, type: :component do let(:options) { { variant: :foobar } } it 'ignores the unknown variant' do - expect(page).to have_css "[class='gl-banner']" + expect(page).to have_css ".gl-banner" end end end diff --git a/spec/frontend/access_tokens/components/__snapshots__/expires_at_field_spec.js.snap b/spec/frontend/access_tokens/components/__snapshots__/expires_at_field_spec.js.snap index 42818c14029..2bd2b17a12d 100644 --- a/spec/frontend/access_tokens/components/__snapshots__/expires_at_field_spec.js.snap +++ b/spec/frontend/access_tokens/components/__snapshots__/expires_at_field_spec.js.snap @@ -21,7 +21,6 @@ exports[`~/access_tokens/components/expires_at_field should render datepicker wi mindate="Mon Jul 06 2020 00:00:00 GMT+0000 (Greenwich Mean Time)" placeholder="YYYY-MM-DD" showclearbutton="true" - size="medium" theme="" /> </gl-form-group-stub> diff --git a/spec/frontend/behaviors/components/json_table_spec.js b/spec/frontend/behaviors/components/json_table_spec.js index ae62d28d6c0..3277e58669a 100644 --- a/spec/frontend/behaviors/components/json_table_spec.js +++ b/spec/frontend/behaviors/components/json_table_spec.js @@ -70,7 +70,7 @@ describe('behaviors/components/json_table', () => { }); it('renders gltable', () => { - expect(findTable().props()).toEqual({ + expect(findTable().props()).toMatchObject({ fields: [], items: [], }); @@ -121,7 +121,7 @@ describe('behaviors/components/json_table', () => { }); it('passes cleaned fields and items to table', () => { - expect(findTable().props()).toEqual({ + expect(findTable().props()).toMatchObject({ fields: [ 'A', { diff --git a/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap index 8e2d46df51f..6af9e38192e 100644 --- a/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap +++ b/spec/frontend/packages_and_registries/infrastructure_registry/components/list/components/__snapshots__/packages_list_app_spec.js.snap @@ -14,45 +14,39 @@ exports[`packages_list_app renders 1`] = ` <div class="gl-max-w-full" > - <div> - <img - alt="" - class="gl-dark-invert-keep-hue gl-max-w-full" - height="144" - role="img" - src="helpSvg" - /> - </div> + <img + alt="" + class="gl-dark-invert-keep-hue gl-max-w-full" + height="144" + role="img" + src="helpSvg" + /> </div> <div - class="gl-m-auto gl-max-w-88" + class="gl-empty-state-content gl-m-auto gl-mx-auto gl-my-0 gl-p-5" data-testid="gl-empty-state-content" > - <div - class="gl-mx-auto gl-my-0 gl-p-5" + <h1 + class="gl-font-size-h-display gl-line-height-36 gl-mb-0 gl-mt-0 h4" > - <h1 - class="gl-font-size-h-display gl-line-height-36 gl-mb-0 gl-mt-0 h4" - > - There are no packages yet - </h1> - <p - class="gl-mb-0 gl-mt-4" + There are no packages yet + </h1> + <p + class="gl-mb-0 gl-mt-4" + > + Learn how to + <b-link-stub + class="gl-link" + href="helpUrl" + target="_blank" > - Learn how to - <b-link-stub - class="gl-link" - href="helpUrl" - target="_blank" - > - publish and share your packages - </b-link-stub> - with GitLab. - </p> - <div - class="gl-display-flex gl-flex-wrap gl-justify-content-center gl-mt-5" - /> - </div> + publish and share your packages + </b-link-stub> + with GitLab. + </p> + <div + class="gl-display-flex gl-flex-wrap gl-justify-content-center gl-mt-5" + /> </div> </section> </div> diff --git a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap index 05a5a718e52..17acf7381c0 100644 --- a/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap +++ b/spec/frontend/packages_and_registries/package_registry/components/details/__snapshots__/pypi_installation_spec.js.snap @@ -78,7 +78,7 @@ exports[`PypiInstallation renders all the messages 1`] = ` tabindex="-1" > <span - class="gl-bg-gray-50! gl-new-dropdown-item-content" + class="gl-new-dropdown-item-content" > <svg aria-hidden="true" diff --git a/spec/lib/gitlab/import_export/repo_restorer_spec.rb b/spec/lib/gitlab/import_export/repo_restorer_spec.rb index 3da7af7509e..3c540eb45c9 100644 --- a/spec/lib/gitlab/import_export/repo_restorer_spec.rb +++ b/spec/lib/gitlab/import_export/repo_restorer_spec.rb @@ -31,7 +31,7 @@ RSpec.describe Gitlab::ImportExport::RepoRestorer do subject { described_class.new(path_to_bundle: bundle_path, shared: shared, importable: project) } after do - Gitlab::Shell.new.remove_repository(project.repository_storage, project.disk_path) + project.repository.remove end it 'restores the repo successfully', :aggregate_failures do @@ -66,7 +66,7 @@ RSpec.describe Gitlab::ImportExport::RepoRestorer do subject { described_class.new(path_to_bundle: bundle_path, shared: shared, importable: ProjectWiki.new(project)) } after do - Gitlab::Shell.new.remove_repository(project.wiki.repository_storage, project.wiki.disk_path) + project.wiki.repository.remove end it 'restores the wiki repo successfully', :aggregate_failures do diff --git a/spec/lib/gitlab/metrics/web_transaction_spec.rb b/spec/lib/gitlab/metrics/web_transaction_spec.rb index dc59fa804c4..ea98c8d7933 100644 --- a/spec/lib/gitlab/metrics/web_transaction_spec.rb +++ b/spec/lib/gitlab/metrics/web_transaction_spec.rb @@ -64,7 +64,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do describe '#labels' do context 'when request goes to Grape endpoint' do before do - route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)') + route = double(:route, request_method: 'GET', path: '/:version/projects/:id/archive(.:format)', origin: '/:version/projects/:id/archive') endpoint = double(:endpoint, route: route, options: { for: API::Projects, path: [":id/archive"] }, namespace: "/projects") @@ -76,7 +76,12 @@ RSpec.describe Gitlab::Metrics::WebTransaction do end it 'provides labels with the method and path of the route in the grape endpoint' do - expect(transaction.labels).to eq({ controller: 'Grape', action: 'GET /projects/:id/archive', feature_category: 'projects' }) + expect(transaction.labels).to eq({ + controller: 'Grape', + action: 'GET /projects/:id/archive', + feature_category: 'projects', + endpoint_id: 'GET /:version/projects/:id/archive' + }) end it 'contains only the labels defined for transactions' do @@ -103,7 +108,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do end it 'tags a transaction with the name and action of a controller' do - expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT }) + expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT, endpoint_id: 'TestController#show' }) end it 'contains only the labels defined for transactions' do @@ -114,7 +119,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do let(:request) { double(:request, format: double(:format, ref: :json)) } it 'appends the mime type to the transaction action' do - expect(transaction.labels).to eq({ controller: 'TestController', action: 'show.json', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT }) + expect(transaction.labels).to eq({ controller: 'TestController', action: 'show.json', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT, endpoint_id: 'TestController#show' }) end end @@ -122,7 +127,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do let(:request) { double(:request, format: double(:format, ref: 'http://example.com')) } it 'does not append the MIME type to the transaction action' do - expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT }) + expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: ::Gitlab::FeatureCategories::FEATURE_CATEGORY_DEFAULT, endpoint_id: 'TestController#show' }) end end @@ -131,7 +136,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do # This is needed since we're not actually making a request, which would trigger the controller pushing to the context ::Gitlab::ApplicationContext.push(feature_category: 'source_code_management') - expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: "source_code_management" }) + expect(transaction.labels).to eq({ controller: 'TestController', action: 'show', feature_category: 'source_code_management', endpoint_id: 'TestController#show' }) end end end @@ -147,7 +152,7 @@ RSpec.describe Gitlab::Metrics::WebTransaction do let(:controller) { double(:controller, class: controller_class, action_name: 'show', request: request) } let(:transaction_obj) { described_class.new({ 'action_controller.instance' => controller }) } - let(:labels) { { controller: 'TestController', action: 'show', feature_category: 'projects' } } + let(:labels) { { controller: 'TestController', action: 'show', feature_category: 'projects', endpoint_id: 'TestController#show' } } before do ::Gitlab::ApplicationContext.push(feature_category: 'projects') diff --git a/spec/lib/gitlab/shell_spec.rb b/spec/lib/gitlab/shell_spec.rb index 7f40e762307..fca2f967f58 100644 --- a/spec/lib/gitlab/shell_spec.rb +++ b/spec/lib/gitlab/shell_spec.rb @@ -13,8 +13,6 @@ RSpec.describe Gitlab::Shell do described_class.instance_variable_set(:@secret_token, nil) end - it { is_expected.to respond_to :remove_repository } - describe '.secret_token' do let(:secret_file) { 'tmp/tests/.secret_shell_test' } let(:link_file) { 'tmp/tests/shell-secret-test/.gitlab_shell_secret' } @@ -83,19 +81,6 @@ RSpec.describe Gitlab::Shell do allow(Gitlab.config.gitlab_shell).to receive(:git_timeout).and_return(800) end - describe '#remove_repository' do - let!(:project) { create(:project, :repository, :legacy_storage) } - let(:disk_path) { "#{project.disk_path}.git" } - - it 'returns true when the command succeeds' do - expect(project.repository.raw).to exist - - expect(gitlab_shell.remove_repository(project.repository_storage, project.disk_path)).to be(true) - - expect(project.repository.raw).not_to exist - end - end - describe '#mv_repository' do let!(:project2) { create(:project, :repository) } diff --git a/spec/lib/sidebars/projects/menus/deployments_menu_spec.rb b/spec/lib/sidebars/projects/menus/deployments_menu_spec.rb index 75f612e9c7c..3224c4cdd33 100644 --- a/spec/lib/sidebars/projects/menus/deployments_menu_spec.rb +++ b/spec/lib/sidebars/projects/menus/deployments_menu_spec.rb @@ -73,7 +73,7 @@ RSpec.describe Sidebars::Projects::Menus::DeploymentsMenu, feature_category: :na let(:item_id) { :pages } before do - allow(project).to receive(:pages_available?).and_return(pages_enabled) + allow(::Gitlab::Pages).to receive(:enabled?).and_return(pages_enabled) end describe 'when pages are enabled' do diff --git a/spec/migrations/20230726144458_swap_notes_id_to_bigint_for_self_managed_spec.rb b/spec/migrations/20230726144458_swap_notes_id_to_bigint_for_self_managed_spec.rb index b4552cebc58..bef9452f397 100644 --- a/spec/migrations/20230726144458_swap_notes_id_to_bigint_for_self_managed_spec.rb +++ b/spec/migrations/20230726144458_swap_notes_id_to_bigint_for_self_managed_spec.rb @@ -115,6 +115,39 @@ RSpec.describe SwapNotesIdToBigintForSelfManaged, feature_category: :database do end end end + + context 'when having different naming for fk_d83a918cb1 foreign key' do + before do + connection.execute('ALTER TABLE system_note_metadata DROP CONSTRAINT IF EXISTS fk_d83a918cb1') + connection.execute('ALTER TABLE system_note_metadata DROP CONSTRAINT IF EXISTS fk_rails_d83a918cb1') + connection.execute('ALTER TABLE system_note_metadata ADD CONSTRAINT fk_rails_d83a918cb1 FOREIGN KEY (note_id) + REFERENCES notes(id) ON DELETE CASCADE') + end + + after do + connection.execute('ALTER TABLE system_note_metadata DROP CONSTRAINT IF EXISTS fk_rails_d83a918cb1') + end + + it 'swaps the columns' do + disable_migrations_output do + reversible_migration do |migration| + migration.before -> { + notes_table.reset_column_information + + expect(notes_table.columns.find { |c| c.name == 'id' }.sql_type).to eq('integer') + expect(notes_table.columns.find { |c| c.name == 'id_convert_to_bigint' }.sql_type).to eq('bigint') + } + + migration.after -> { + notes_table.reset_column_information + + expect(notes_table.columns.find { |c| c.name == 'id' }.sql_type).to eq('bigint') + expect(notes_table.columns.find { |c| c.name == 'id_convert_to_bigint' }.sql_type).to eq('integer') + } + end + end + end + end end end end diff --git a/spec/models/loose_foreign_keys/deleted_record_spec.rb b/spec/models/loose_foreign_keys/deleted_record_spec.rb index ed80f5c1516..619f77b6bec 100644 --- a/spec/models/loose_foreign_keys/deleted_record_spec.rb +++ b/spec/models/loose_foreign_keys/deleted_record_spec.rb @@ -16,30 +16,20 @@ RSpec.describe LooseForeignKeys::DeletedRecord, type: :model, feature_category: let(:records) { described_class.load_batch_for_table(table, 10) } describe '.load_batch_for_table' do - where(:union_feature_flag_value) do - [true, false] + it 'loads records and orders them by creation date' do + expect(records).to eq([deleted_record_1, deleted_record_2, deleted_record_4]) end - with_them do - before do - stub_feature_flags('loose_foreign_keys_batch_load_using_union' => union_feature_flag_value) - end - - it 'loads records and orders them by creation date' do - expect(records).to eq([deleted_record_1, deleted_record_2, deleted_record_4]) - end + it 'supports configurable batch size' do + records = described_class.load_batch_for_table(table, 2) - it 'supports configurable batch size' do - records = described_class.load_batch_for_table(table, 2) - - expect(records).to eq([deleted_record_1, deleted_record_2]) - end + expect(records).to eq([deleted_record_1, deleted_record_2]) + end - it 'returns the partition number in each returned record' do - records = described_class.load_batch_for_table(table, 4) + it 'returns the partition number in each returned record' do + records = described_class.load_batch_for_table(table, 4) - expect(records).to all(have_attributes(partition: (a_value > 0))) - end + expect(records).to all(have_attributes(partition: (a_value > 0))) end end diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index a750bc5fcff..cc49661b118 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -5146,28 +5146,6 @@ RSpec.describe Project, factory_default: :keep, feature_category: :groups_and_pr end end - describe '#pages_available?' do - let(:project) { create(:project, group: group) } - - subject { project.pages_available? } - - before do - allow(Gitlab.config.pages).to receive(:enabled).and_return(true) - end - - context 'when the project is in a top level namespace' do - let(:group) { create(:group) } - - it { is_expected.to be(true) } - end - - context 'when the project is in a subgroup' do - let(:group) { create(:group, :nested) } - - it { is_expected.to be(true) } - end - end - describe '#remove_private_deploy_keys' do let!(:project) { create(:project) } diff --git a/spec/services/snippets/destroy_service_spec.rb b/spec/services/snippets/destroy_service_spec.rb index ace9847185e..29898e3ab09 100644 --- a/spec/services/snippets/destroy_service_spec.rb +++ b/spec/services/snippets/destroy_service_spec.rb @@ -70,7 +70,6 @@ RSpec.describe Snippets::DestroyService, feature_category: :source_code_manageme it 'does not schedule anything and return success' do allow(snippet).to receive(:repository).and_return(nil) - expect(GitlabShellWorker).not_to receive(:perform_in) expect_next_instance_of(Repositories::DestroyService) do |instance| expect(instance).to receive(:execute).and_call_original end @@ -151,7 +150,6 @@ RSpec.describe Snippets::DestroyService, feature_category: :source_code_manageme expect(snippet.repository).not_to be_nil expect(snippet.repository.exists?).to be_falsey - expect(GitlabShellWorker).not_to receive(:perform_in) expect_next_instance_of(Repositories::DestroyService) do |instance| expect(instance).to receive(:execute).and_call_original end diff --git a/spec/support/helpers/javascript_fixtures_helpers.rb b/spec/support/helpers/javascript_fixtures_helpers.rb index 417bf4366c5..191defc09ef 100644 --- a/spec/support/helpers/javascript_fixtures_helpers.rb +++ b/spec/support/helpers/javascript_fixtures_helpers.rb @@ -39,7 +39,7 @@ module JavaScriptFixturesHelpers end def remove_repository(project) - Gitlab::Shell.new.remove_repository(project.repository_storage, project.disk_path) + project.repository.remove end # Public: Reads a GraphQL query from the filesystem as a string diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index b58a2b4612c..03c1bed68ed 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -2352,7 +2352,6 @@ - './ee/spec/serializers/evidences/build_artifact_entity_spec.rb' - './ee/spec/serializers/evidences/evidence_entity_spec.rb' - './ee/spec/serializers/fork_namespace_entity_spec.rb' -- './ee/spec/serializers/geo_project_registry_entity_spec.rb' - './ee/spec/serializers/group_vulnerability_autocomplete_entity_spec.rb' - './ee/spec/serializers/integrations/field_entity_spec.rb' - './ee/spec/serializers/integrations/jira_serializers/issue_detail_entity_spec.rb' @@ -3151,18 +3150,7 @@ - './ee/spec/workers/geo/prune_event_log_worker_spec.rb' - './ee/spec/workers/geo/registry_sync_worker_spec.rb' - './ee/spec/workers/geo/repositories_clean_up_worker_spec.rb' -- './ee/spec/workers/geo/repository_cleanup_worker_spec.rb' -- './ee/spec/workers/geo_repository_destroy_worker_spec.rb' -- './ee/spec/workers/geo/repository_shard_sync_worker_spec.rb' -- './ee/spec/workers/geo/repository_sync_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/primary/batch_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/primary/shard_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/primary/single_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/secondary/scheduler_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/secondary/shard_worker_spec.rb' -- './ee/spec/workers/geo/repository_verification/secondary/single_worker_spec.rb' - './ee/spec/workers/geo/reverification_batch_worker_spec.rb' -- './ee/spec/workers/geo/scheduler/per_shard_scheduler_worker_spec.rb' - './ee/spec/workers/geo/scheduler/scheduler_worker_spec.rb' - './ee/spec/workers/geo/secondary/registry_consistency_worker_spec.rb' - './ee/spec/workers/geo/secondary_usage_data_cron_worker_spec.rb' diff --git a/spec/workers/every_sidekiq_worker_spec.rb b/spec/workers/every_sidekiq_worker_spec.rb index ce31ff9f956..59d93142d37 100644 --- a/spec/workers/every_sidekiq_worker_spec.rb +++ b/spec/workers/every_sidekiq_worker_spec.rb @@ -315,7 +315,6 @@ RSpec.describe 'Every Sidekiq worker', feature_category: :shared do 'GitlabPerformanceBarStatsWorker' => 3, 'GitlabSubscriptions::RefreshSeatsWorker' => 0, 'GitlabSubscriptions::AddOnPurchases::BulkRefreshUserAssignmentsWorker' => 0, - 'GitlabShellWorker' => 3, 'GitlabServicePingWorker' => 3, 'GroupDestroyWorker' => 3, 'GroupExportWorker' => false, diff --git a/spec/workers/gitlab_shell_worker_spec.rb b/spec/workers/gitlab_shell_worker_spec.rb deleted file mode 100644 index 9fff4489667..00000000000 --- a/spec/workers/gitlab_shell_worker_spec.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe GitlabShellWorker, :sidekiq_inline, feature_category: :source_code_management do - describe '#perform' do - Gitlab::Shell::PERMITTED_ACTIONS.each do |action| - describe "with the #{action} action" do - it 'forwards the message to Gitlab::Shell' do - expect_next_instance_of(Gitlab::Shell) do |instance| - expect(instance).to respond_to(action) - expect(instance).to receive(action).with('foo', 'bar') - end - - described_class.perform_async(action, 'foo', 'bar') - end - end - end - - describe 'all other commands' do - it 'raises ArgumentError' do - allow_next_instance_of(described_class) do |job_instance| - expect(job_instance).not_to receive(:gitlab_shell) - end - - expect { described_class.perform_async('foo', 'bar', 'baz') } - .to raise_error(ArgumentError, 'foo not allowed for GitlabShellWorker') - end - end - end -end |