diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-15 00:07:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-15 00:07:17 +0300 |
commit | 046498496e140f96beb63ff45ec9b0bb9acdbdd3 (patch) | |
tree | 5d6854c7dc9ce586f13268927c9d7178965a78c4 /spec | |
parent | 0ce623783c5970e2439cda2a5eab8cbb81c194c3 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
-rw-r--r-- | spec/frontend/search/topbar/components/app_spec.js | 18 | ||||
-rw-r--r-- | spec/frontend/search/topbar/components/search_type_indicator_spec.js | 26 | ||||
-rw-r--r-- | spec/lib/gitlab/database/postgres_index_spec.rb | 9 | ||||
-rw-r--r-- | spec/support/rspec_run_time.rb | 11 |
4 files changed, 42 insertions, 22 deletions
diff --git a/spec/frontend/search/topbar/components/app_spec.js b/spec/frontend/search/topbar/components/app_spec.js index ce1df3caabc..d17bdc2a6e1 100644 --- a/spec/frontend/search/topbar/components/app_spec.js +++ b/spec/frontend/search/topbar/components/app_spec.js @@ -108,15 +108,15 @@ describe('GlobalSearchTopbar', () => { }); describe.each` - state | defaultBranchName | hasSyntaxOptions - ${{ query: { repository_ref: '' }, searchType: 'basic' }} | ${'master'} | ${false} - ${{ query: { repository_ref: 'v0.1' }, searchType: 'basic' }} | ${''} | ${false} - ${{ query: { repository_ref: 'master' }, searchType: 'basic' }} | ${'master'} | ${false} - ${{ query: { repository_ref: 'master' }, searchType: 'advanced' }} | ${''} | ${false} - ${{ query: { repository_ref: '' }, searchType: 'advanced' }} | ${'master'} | ${true} - ${{ query: { repository_ref: 'v0.1' }, searchType: 'advanced' }} | ${''} | ${false} - ${{ query: { repository_ref: 'master' }, searchType: 'advanced' }} | ${'master'} | ${true} - ${{ query: { repository_ref: 'master' }, searchType: 'zoekt' }} | ${'master'} | ${true} + state | hasSyntaxOptions + ${{ query: { repository_ref: '' }, searchType: 'basic', searchLevel: 'project', defaultBranchName: 'master' }} | ${false} + ${{ query: { repository_ref: 'v0.1' }, searchType: 'basic', searchLevel: 'project', defaultBranchName: '' }} | ${false} + ${{ query: { repository_ref: 'master' }, searchType: 'basic', searchLevel: 'project', defaultBranchName: 'master' }} | ${false} + ${{ query: { repository_ref: 'master' }, searchType: 'advanced', searchLevel: 'project', defaultBranchName: '' }} | ${false} + ${{ query: { repository_ref: '' }, searchType: 'advanced', searchLevel: 'project', defaultBranchName: 'master' }} | ${true} + ${{ query: { repository_ref: 'v0.1' }, searchType: 'advanced', searchLevel: 'project', defaultBranchName: '' }} | ${false} + ${{ query: { repository_ref: 'master' }, searchType: 'advanced', searchLevel: 'project', defaultBranchName: 'master' }} | ${true} + ${{ query: { repository_ref: 'master' }, searchType: 'zoekt', searchLevel: 'project', defaultBranchName: 'master' }} | ${true} `( `the syntax option based on component state`, ({ state, defaultBranchName, hasSyntaxOptions }) => { diff --git a/spec/frontend/search/topbar/components/search_type_indicator_spec.js b/spec/frontend/search/topbar/components/search_type_indicator_spec.js index 91af062aa97..d69ca6dfb16 100644 --- a/spec/frontend/search/topbar/components/search_type_indicator_spec.js +++ b/spec/frontend/search/topbar/components/search_type_indicator_spec.js @@ -17,7 +17,7 @@ describe('SearchTypeIndicator', () => { preloadStoredFrequentItems: jest.fn(), }; - const createComponent = (initialState = {}, defaultBranchName = '') => { + const createComponent = (initialState = {}) => { const store = new Vuex.Store({ state: { query: MOCK_QUERY, @@ -28,7 +28,6 @@ describe('SearchTypeIndicator', () => { wrapper = shallowMountExtended(SearchTypeIndicator, { store, - propsData: { defaultBranchName }, stubs: { GlSprintf, }, @@ -39,19 +38,26 @@ describe('SearchTypeIndicator', () => { const findDocsLink = () => wrapper.findComponentByTestId('docs-link'); const findSyntaxDocsLink = () => wrapper.findComponentByTestId('syntax-docs-link'); + // searchType and search level params cobination in this test reflects + // all possible combinations + describe.each` - searchType | repository | showSearchTypeIndicator - ${'advanced'} | ${'master'} | ${'advanced-enabled'} - ${'advanced'} | ${'v0.1'} | ${'advanced-disabled'} - ${'zoekt'} | ${'master'} | ${'zoekt-enabled'} - ${'zoekt'} | ${'v0.1'} | ${'zoekt-disabled'} + searchType | searchLevel | repository | showSearchTypeIndicator + ${'advanced'} | ${'project'} | ${'master'} | ${'advanced-enabled'} + ${'advanced'} | ${'project'} | ${'v0.1'} | ${'advanced-disabled'} + ${'advanced'} | ${'group'} | ${'master'} | ${'advanced-enabled'} + ${'advanced'} | ${'global'} | ${'master'} | ${'advanced-enabled'} + ${'zoekt'} | ${'project'} | ${'master'} | ${'zoekt-enabled'} + ${'zoekt'} | ${'project'} | ${'v0.1'} | ${'zoekt-disabled'} + ${'zoekt'} | ${'group'} | ${'master'} | ${'zoekt-enabled'} `( - 'search type indicator for $searchType', - ({ searchType, repository, showSearchTypeIndicator }) => { + 'search type indicator for $searchType $searchLevel', + ({ searchType, repository, showSearchTypeIndicator, searchLevel }) => { beforeEach(() => { createComponent({ query: { repository_ref: repository }, searchType, + searchLevel, defaultBranchName: 'master', }); }); @@ -93,6 +99,7 @@ describe('SearchTypeIndicator', () => { createComponent({ query: { repository_ref: 'master' }, searchType, + searchLevel: 'project', defaultBranchName: 'master', }); }); @@ -110,6 +117,7 @@ describe('SearchTypeIndicator', () => { createComponent({ query: { repository_ref: '000' }, searchType, + searchLevel: 'project', defaultBranchName: 'master', }); }); diff --git a/spec/lib/gitlab/database/postgres_index_spec.rb b/spec/lib/gitlab/database/postgres_index_spec.rb index 2e654a33a58..fd2455e25c0 100644 --- a/spec/lib/gitlab/database/postgres_index_spec.rb +++ b/spec/lib/gitlab/database/postgres_index_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Database::PostgresIndex do +RSpec.describe Gitlab::Database::PostgresIndex, feature_category: :database do let(:schema) { 'public' } let(:name) { 'foo_idx' } let(:identifier) { "#{schema}.#{name}" } @@ -13,6 +13,9 @@ RSpec.describe Gitlab::Database::PostgresIndex do CREATE UNIQUE INDEX bar_key ON public.users (id); CREATE TABLE _test_gitlab_main_example_table (id serial primary key); + + CREATE TABLE _test_partitioned (id bigserial primary key not null) PARTITION BY LIST (id); + CREATE TABLE _test_partitioned_1 PARTITION OF _test_partitioned FOR VALUES IN (1); SQL end @@ -25,8 +28,8 @@ RSpec.describe Gitlab::Database::PostgresIndex do it { is_expected.to be_a Gitlab::Database::SharedModel } describe '.reindexing_support' do - it 'only non partitioned indexes' do - expect(described_class.reindexing_support).to all(have_attributes(partitioned: false)) + it 'includes partitioned indexes' do + expect(described_class.reindexing_support.where("name = '_test_partitioned_1_pkey'")).not_to be_empty end it 'only indexes that dont serve an exclusion constraint' do diff --git a/spec/support/rspec_run_time.rb b/spec/support/rspec_run_time.rb index 976e902258d..977d4885624 100644 --- a/spec/support/rspec_run_time.rb +++ b/spec/support/rspec_run_time.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'os' require 'yaml' require 'rspec/core/formatters/base_formatter' require_relative '../../tooling/lib/tooling/helpers/duration_formatter' @@ -84,11 +85,19 @@ module Support # skip the output unless the duration increased by at least 1 second unless @last_elapsed_seconds.nil? || elapsed_seconds - @last_elapsed_seconds < 1 - output.puts "# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}.\n\n" + output.puts \ + "# [RSpecRunTime] RSpec elapsed time: #{readable_duration(elapsed_seconds)}. " \ + "#{current_rss_in_megabytes}\n\n" end @last_elapsed_seconds = elapsed_seconds end + + def current_rss_in_megabytes + rss_in_megabytes = OS.rss_bytes / 1024 / 1024 + + "Current RSS: ~#{rss_in_megabytes.round}M" + end end end end |