Commit 7fbfa21a authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 32e91540 08a2b304
d950585cb9763c6014ae2c9b7c4f4923d90c9f81
40fae4205d3ad62ca9341620146486bee8d31b28
......@@ -7,4 +7,4 @@
= render partial: 'shared/deploy_keys/form', locals: { form: f, deploy_key: @deploy_key }
.form-actions
= f.submit 'Create', class: 'btn gl-button btn-confirm', data: { qa_selector: "add_deploy_key_button" }
= link_to 'Cancel', admin_deploy_keys_path, class: 'btn gl-button btn-default btn-cancel'
= link_to _('Cancel'), admin_deploy_keys_path, class: 'btn gl-button btn-default btn-cancel'
- add_to_breadcrumbs "Users", admin_users_path
- add_to_breadcrumbs _('Users'), admin_users_path
- add_to_breadcrumbs @user.name, admin_user_identities_path(@user)
- breadcrumb_title "Edit Identity"
- breadcrumb_title _('Edit Identity')
- page_title _("Edit"), @identity.provider, _("Identities"), @user.name, _("Users")
%h3.page-title
= _('Edit identity for %{user_name}') % { user_name: @user.name }
......
- add_to_breadcrumbs "Users", admin_users_path
- add_to_breadcrumbs _('Users'), admin_users_path
- breadcrumb_title @user.name
- page_title _("Identities"), @user.name, _("Users")
= render 'admin/users/head'
......
- add_to_breadcrumbs "Users", admin_users_path
- add_to_breadcrumbs _('Users'), admin_users_path
- add_to_breadcrumbs @user.name, admin_user_identities_path(@user)
- breadcrumb_title "New Identity"
- page_title _("New Identity")
- breadcrumb_title _('New Identity')
- page_title _('New Identity')
%h3.page-title= _('New identity')
%hr
= render 'form'
- add_to_breadcrumbs 'Users', admin_users_path
- add_to_breadcrumbs _('Users'), admin_users_path
- breadcrumb_title @user.name
- page_title _('Impersonation Tokens'), @user.name, _('Users')
- type = _('impersonation token')
......
......@@ -27,7 +27,7 @@
%strong
= project.full_name
.gl-alert-actions
= link_to s_('Disable'), admin_namespace_project_runner_project_path(project.namespace, project, runner_project), method: :delete, class: 'btn gl-alert-action btn-confirm btn-md gl-button'
= link_to _('Disable'), admin_namespace_project_runner_project_path(project.namespace, project, runner_project), method: :delete, class: 'btn gl-alert-action btn-confirm btn-md gl-button'
%table.table{ data: { testid: 'unassigned-projects' } }
%thead
......
%tr
%th
= s_('Key')
= _('Key')
%th
= s_('Environments')
= _('Environments')
%th
= s_('Group')
= _('Group')
......@@ -12,5 +12,5 @@
= s_('403|Please contact your GitLab administrator to get permission.')
.action-container.js-go-back{ hidden: true }
%button{ type: 'button', class: 'gl-button btn btn-success' }
= s_('Go Back')
= _('Go Back')
= render "errors/footer"
......@@ -24,7 +24,7 @@
- if current_user
.gl-display-flex.gl-flex-wrap.gl-lg-justify-content-end.gl-mx-n2{ data: { testid: 'group-buttons' } }
- if current_user.admin?
= link_to [:admin, @group], class: 'btn btn-default gl-button btn-icon gl-mt-3 gl-mr-2', title: s_('View group in admin area'),
= link_to [:admin, @group], class: 'btn btn-default gl-button btn-icon gl-mt-3 gl-mr-2', title: _('View group in admin area'),
data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= sprite_icon('admin')
- if @notification_setting
......
- add_to_breadcrumbs "SSH Keys", profile_keys_path
- add_to_breadcrumbs _('SSH Keys'), profile_keys_path
- breadcrumb_title @key.title
- page_title @key.title, _('SSH Keys')
- @content_class = "limit-container-width" unless fluid_layout
......
......@@ -112,7 +112,7 @@
= f.text_field :organization, label: s_('Profiles|Organization'), class: 'input-md gl-form-input', help: s_("Profiles|Who you represent or work for")
= f.text_area :bio, class: 'gl-form-input', label: s_('Profiles|Bio'), rows: 4, maxlength: 250, help: s_("Profiles|Tell us about yourself in fewer than 250 characters")
%hr
%h5= s_("Private profile")
%h5= _('Private profile')
.checkbox-icon-inline-wrapper
- private_profile_label = capture do
= s_("Profiles|Don't display activity-related personal information on your profiles")
......
.form-actions.gl-display-flex
= button_tag 'Commit changes', id: 'commit-changes', class: 'gl-button btn btn-confirm js-commit-button qa-commit-button'
= link_to 'Cancel', cancel_path,
= link_to _('Cancel'), cancel_path,
class: 'gl-button btn btn-default gl-ml-3', data: {confirm: leave_edit_message}
= render 'shared/projects/edit_information'
......@@ -31,7 +31,7 @@
.project-repo-buttons.gl-display-flex.gl-justify-content-md-end.gl-align-items-start.gl-flex-wrap.gl-mt-5
- if current_user
- if current_user.admin?
= link_to [:admin, @project], class: 'btn gl-button btn-icon gl-align-self-start gl-py-2! gl-mr-3', title: s_('View project in admin area'),
= link_to [:admin, @project], class: 'btn gl-button btn-icon gl-align-self-start gl-py-2! gl-mr-3', title: _('View project in admin area'),
data: {toggle: 'tooltip', placement: 'bottom', container: 'body'} do
= sprite_icon('admin')
.gl-display-flex.gl-align-items-start.gl-mr-3
......
......@@ -11,7 +11,7 @@
= f.text_field :name, placeholder: "My awesome project", class: "form-control gl-form-input input-lg", autofocus: true, data: { track_label: "#{track_label}", track_event: "activate_form_input", track_property: "project_name", track_value: "" }, required: true, aria: { required: true }
.form-group.project-path.col-sm-6
= f.label :namespace_id, class: 'label-bold' do
%span= s_("Project URL")
%span= _('Project URL')
.input-group.gl-flex-nowrap
- if current_user.can_select_namespace?
- namespace_id = namespace_id_from(params)
......
......@@ -16,6 +16,6 @@
.form-actions
= submit_tag _("Create directory"), class: 'btn gl-button btn-confirm'
= link_to "Cancel", '#', class: "btn gl-button btn-default btn-cancel", "data-dismiss" => "modal"
= link_to _('Cancel'), '#', class: "btn gl-button btn-default btn-cancel", "data-dismiss" => "modal"
= render 'shared/projects/edit_information'
......@@ -13,4 +13,4 @@
.form-group.row
.offset-sm-2.col-sm-10
= button_tag 'Delete file', class: 'btn gl-button btn-danger btn-remove-file'
= link_to "Cancel", '#', class: "btn gl-button btn-cancel", "data-dismiss" => "modal"
= link_to _('Cancel'), '#', class: "btn gl-button btn-cancel", "data-dismiss" => "modal"
- breadcrumb_title "Repository"
- breadcrumb_title _('Repository')
- page_title @blob.path, @ref
- signatures_path = namespace_project_signatures_path(namespace_id: @project.namespace.full_path, project_id: @project.path, id: @last_commit, limit: 1)
- content_for :prefetch_asset_tags do
......
......@@ -30,5 +30,5 @@
.form-text.text-muted Existing branch name, tag, or commit SHA
.form-actions
= button_tag 'Create branch', class: 'gl-button btn btn-confirm'
= link_to 'Cancel', project_branches_path(@project), class: 'gl-button btn btn-default btn-cancel'
= link_to _('Cancel'), project_branches_path(@project), class: 'gl-button btn btn-default btn-cancel'
%script#availableRefs{ type: "application/json" }= @project.repository.ref_names.to_json.html_safe
- page_title _('Error Details')
- add_to_breadcrumbs 'Errors', project_error_tracking_index_path(@project)
- add_to_breadcrumbs _('Errors'), project_error_tracking_index_path(@project)
- add_page_specific_style 'page_bundles/error_tracking_details'
#js-error_details{ data: error_details_data(@project, @issue_id) }
......@@ -42,5 +42,5 @@
%hr
.clearfix
.float-right
= link_to 'Cancel', edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg'
= link_to _('Cancel'), edit_project_service_path(@project, @integration), class: 'gl-button btn btn-lg'
= f.submit 'Install', class: 'gl-button btn btn-success btn-lg'
......@@ -27,7 +27,7 @@
%td
.float-right.btn-group
- if can?(current_user, :play_pipeline_schedule, pipeline_schedule)
= link_to play_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('Play'), class: 'btn gl-button btn-default btn-icon' do
= link_to play_pipeline_schedule_path(pipeline_schedule), method: :post, title: _('Play'), class: 'btn gl-button btn-default btn-icon' do
= sprite_icon('play')
- if can?(current_user, :take_ownership_pipeline_schedule, pipeline_schedule)
= link_to take_ownership_pipeline_schedule_path(pipeline_schedule), method: :post, title: s_('PipelineSchedules|Take ownership'), class: 'btn gl-button btn-default' do
......
- breadcrumb_title "Schedules"
- breadcrumb_title _('Schedules')
- @breadcrumb_link = namespace_project_pipeline_schedules_path(@project.namespace, @project)
- page_title _("New Pipeline Schedule")
- add_page_specific_style 'page_bundles/pipeline_schedules'
......
......@@ -16,4 +16,4 @@
.error-alert
.gl-mt-5.gl-display-flex
= f.submit _('Save changes'), class: 'btn gl-button btn-confirm gl-mr-3'
= link_to "Cancel", project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel"
= link_to _('Cancel'), project_tag_path(@project, @tag.name), class: "btn gl-button btn-default btn-cancel"
......@@ -31,4 +31,4 @@
= f.submit _('Save changes'), class: 'btn gl-button btn-confirm js-save-button'
- else
= f.submit 'Create label', class: 'btn gl-button btn-confirm js-save-button qa-label-create-button'
= link_to 'Cancel', back_path, class: 'btn gl-button btn-default btn-cancel'
= link_to _('Cancel'), back_path, class: 'btn gl-button btn-default btn-cancel'
......@@ -60,4 +60,4 @@
- if runner.contacted_at
= time_ago_with_tooltip runner.contacted_at
- else
= s_('Never')
= _('Never')
- add_to_breadcrumbs "Wiki", wiki_path(@wiki)
- add_to_breadcrumbs _('Wiki'), wiki_path(@wiki)
- breadcrumb_title s_("Wiki|Pages")
- page_title s_("Wiki|Pages"), _("Wiki")
- sort_title = wiki_sort_title(params[:sort])
......
......@@ -3,7 +3,7 @@ module Elastic
module ApplicationVersionedSearch
extend ActiveSupport::Concern
FORWARDABLE_INSTANCE_METHODS = [:es_id, :es_parent].freeze
FORWARDABLE_INSTANCE_METHODS = [:es_id, :es_parent, :namespace_ancestry].freeze
FORWARDABLE_CLASS_METHODS = [:elastic_search, :es_import, :es_type, :index_name, :document_type, :mapping, :mappings, :settings, :import].freeze
# rubocop:disable Gitlab/ModuleWithInstanceVariables
......
......@@ -31,21 +31,13 @@ module EE
end
def update_elasticsearch_hooks(updated_project_ids)
# Handle when group is moved to a new group. There is no way to know
# whether the group was using Elasticsearch before the transfer. If Elasticsearch limit indexing is
# enabled, each associated project has the ES cache is invalidated all associated data is indexed.
# If Elasticsearch limit indexing is disabled, all projects are indexed and only those with visibility
# changes have their ES cache entry invalidated.
if ::Gitlab::CurrentSettings.elasticsearch_limit_indexing?
::Project.id_in(group.all_projects.select(:id)).find_each do |project|
project.invalidate_elasticsearch_indexes_cache!
::Elastic::ProcessInitialBookkeepingService.backfill_projects!(project) if project.maintaining_elasticsearch?
end
else
::Project.id_in(updated_project_ids).find_each do |project|
project.maintain_elasticsearch_update(updated_attributes: [:visibility_level]) if project.maintaining_elasticsearch?
end
# When a group is moved to a new group, there is no way to know whether the group was using Elasticsearch
# before the transfer. If Elasticsearch limit indexing is enabled, each project has the ES cache
# invalidated. Reindex all projects and associated data to make sure the namespace_ancestry field gets
# updated in each document.
::Project.id_in(group.all_projects.select(:id)).find_each do |project|
project.invalidate_elasticsearch_indexes_cache! if ::Gitlab::CurrentSettings.elasticsearch_limit_indexing?
::Elastic::ProcessInitialBookkeepingService.backfill_projects!(project) if project.maintaining_elasticsearch?
end
end
end
......
......@@ -35,15 +35,14 @@ module EE
end
def update_elasticsearch_hooks
return unless ::Gitlab::CurrentSettings.elasticsearch_limit_indexing?
# handle when project is moved to a new namespace with different elasticsearch settings
# than the old namespace
if old_namespace.use_elasticsearch? != new_namespace.use_elasticsearch?
# When a project is moved to a new namespace, invalidate the ES cache if Elasticsearch limit indexing is enabled
# and the Elasticsearch settings are different between the two namespaces. The project and all associated data
# is indexed to make sure the namespace_ancestry field gets updated in each document.
if ::Gitlab::CurrentSettings.elasticsearch_limit_indexing? && old_namespace.use_elasticsearch? != new_namespace.use_elasticsearch?
project.invalidate_elasticsearch_indexes_cache!
::Elastic::ProcessInitialBookkeepingService.backfill_projects!(project) if project.maintaining_elasticsearch?
end
::Elastic::ProcessInitialBookkeepingService.backfill_projects!(project) if project.maintaining_elasticsearch?
end
override :remove_paid_features
......
......@@ -3,7 +3,7 @@
- f = local_assigns.fetch(:form)
.form-group
= f.label s_('Default delayed project deletion'), class: 'label-bold'
= f.label _('Default delayed project deletion'), class: 'label-bold'
.form-check
= f.check_box :delayed_project_deletion, class: 'form-check-input'
= f.label :delayed_project_deletion, class: 'form-check-label' do
......
......@@ -3,7 +3,7 @@
- f = local_assigns.fetch(:form)
.form-group
= f.label s_('Default deletion delay'), class: 'label-bold'
= f.label _('Default deletion delay'), class: 'label-bold'
= f.select :deletion_adjourned_period, options_for_select(0..90, @application_setting.deletion_adjourned_period), {}, class: 'form-control gl-form-input'
= f.label :deletion_adjourned_period, class: 'form-check-label' do
= _('How many days need to pass between marking entity for deletion and actual removing it.')
......@@ -3,7 +3,7 @@
- f = local_assigns.fetch(:form)
.form-group
= f.label s_('Default project deletion protection'), class: 'label-bold'
= f.label _('Default project deletion protection'), class: 'label-bold'
.form-check
= f.check_box :default_project_deletion_protection, class: 'form-check-input'
= f.label :default_project_deletion_protection, class: 'form-check-label' do
......
- page_title s_('Contribution Analytics')
- page_title _('Contribution Analytics')
- if @group.licensed_feature_available?(:contribution_analytics)
.mb-3
%h3
= s_('Contribution Analytics')
= _('Contribution Analytics')
.sub-header-block
.float-right
......
......@@ -20,4 +20,4 @@
%span
Save changes
 
= link_to 'Cancel', edit_project_service_path(@project, @service), class: 'btn gl-button btn-cancel'
= link_to _('Cancel'), edit_project_service_path(@project, @service), class: 'btn gl-button btn-cancel'
......@@ -19,7 +19,7 @@
%div
%p
= s_('Promotions|Epics let you manage your portfolio of projects more efficiently and with less effort by tracking groups of issues that share a theme, across projects and milestones.')
= link_to s_('Read more'), 'https://docs.gitlab.com/ee/user/group/epics/', class: 'btn-link', target: '_blank'
= link_to _('Read more'), 'https://docs.gitlab.com/ee/user/group/epics/', class: 'btn-link', target: '_blank'
.gl-flex-wrap
= render 'shared/promotions/promotion_link_project', short_form: true, location: :epics
= link_to s_("Promotions|Don't show me this again"), '#', class: 'gl-button btn js-close js-close-callout gl-mt-2'
......
......@@ -102,5 +102,9 @@ module Elastic
}
}
end
def update_mapping!(index_name, mappings)
helper.update_mapping(index_name: index_name, mappings: mappings)
end
end
end
# frozen_string_literal: true
class AddNamespaceAncestryToIssuesMapping < Elastic::Migration
include Elastic::MigrationHelper
DOCUMENT_KLASS = Issue
def migrate
if completed?
log 'Skipping adding namespace_ancestry to issues mapping migration since it is already applied'
return
end
log 'Adding namespace_ancestry to issues mapping'
update_mapping!(index_name, { properties: { namespace_ancestry: { type: 'text', index_prefixes: { min_chars: 1, max_chars: 19 } } } })
end
def completed?
helper.refresh_index(index_name: index_name)
mappings = helper.get_mapping(index_name: index_name)
mappings.dig('namespace_ancestry').present?
end
private
def index_name
DOCUMENT_KLASS.__elasticsearch__.index_name
end
end
......@@ -17,6 +17,12 @@ module Elastic
"#{es_type}_#{target.id}"
end
def namespace_ancestry
project = target.is_a?(Project) ? target : target.project
namespace = project.namespace
namespace.self_and_ancestor_ids(hierarchy_order: :desc).join('-')
end
private
def generic_attributes
......
......@@ -30,7 +30,7 @@ module Elastic
# rubocop: disable CodeReuse/ActiveRecord
def preload_indexing_data(relation)
relation.includes(:issue_assignees, project: [:project_feature])
relation.includes(:issue_assignees, project: [:project_feature, :namespace])
end
# rubocop: enable CodeReuse/ActiveRecord
......
......@@ -36,6 +36,7 @@ module Elastic
indexes :visibility_level, type: :integer
indexes :issues_access_level, type: :integer
indexes :upvotes, type: :integer
indexes :namespace_ancestry, type: :text, index_prefixes: { min_chars: 1, max_chars: 19 }
end
end
end
......
......@@ -21,6 +21,7 @@ module Elastic
data['issues_access_level'] = safely_read_project_feature_for_elasticsearch(:issues)
data['upvotes'] = target.upvotes_count
data['namespace_ancestry'] = target.namespace_ancestry if Elastic::DataMigrationService.migration_has_finished?(:add_namespace_ancestry_to_issues_mapping)
data.merge(generic_attributes)
end
......
......@@ -229,10 +229,20 @@ module Gitlab
settings.dig(index, 'settings', 'index')
end
def get_mapping(index_name: nil)
index = target_index_name(target: index_name)
mappings = client.indices.get_mapping(index: index)
mappings.dig(index, 'mappings', 'properties')
end
def update_settings(index_name: nil, settings:)
client.indices.put_settings(index: index_name || target_index_name, body: settings)
end
def update_mapping(index_name: nil, mappings:)
client.indices.put_mapping(index: index_name || target_index_name, body: mappings)
end
def switch_alias(from: target_index_name, alias_name: target_name, to:)
actions = [
{
......
......@@ -312,11 +312,11 @@ RSpec.describe Registrations::GroupsController do
subject
end
it 'selectivly tracks for the force_company_trial experiment', :experiment do
it 'selectively tracks for the force_company_trial experiment', :experiment do
wrapped_experiment(experiment(:force_company_trial)) do |e|
expect(e.context.value).to include(user: user)
expect(e).to receive(:track).with(:create_group, namespace: an_instance_of(Group))
expect(e).not_to receive(:track).with(:create_trial, namespace: an_instance_of(Group))
expect(e).to receive(:track).with(:create_group, namespace: an_instance_of(Group), user: user)
expect(e).not_to receive(:track).with(:create_trial, namespace: an_instance_of(Group), user: user)
end
subject
......
# frozen_string_literal: true
require 'spec_helper'
require File.expand_path('ee/elastic/migrate/20210813134600_add_namespace_ancestry_to_issues_mapping.rb')
RSpec.describe AddNamespaceAncestryToIssuesMapping, :elastic, :sidekiq_inline do
let(:version) { 20210813134600 }
let(:migration) { described_class.new(version) }
let(:helper) { Gitlab::Elastic::Helper.new }
before do
allow(migration).to receive(:helper).and_return(helper)
end
describe '.migrate' do
subject { migration.migrate }
context 'when migration is already completed' do
it 'does not modify data' do
expect(helper).not_to receive(:update_mapping)
subject
end
end
context 'migration process' do
before do
allow(helper).to receive(:get_mapping).and_return({})
end
it 'updates the issues index mappings' do
expect(helper).to receive(:update_mapping)
subject
end
end
end
describe '.completed?' do
context 'mapping has been updated' do
specify { expect(migration).to be_completed }
end
context 'mapping has not been updated' do
before do
allow(helper).to receive(:get_mapping).and_return({})
end
specify { expect(migration).not_to be_completed }
end
end
end
......@@ -105,33 +105,48 @@ RSpec.describe Issue, :elastic do
expect(results.first.title).to eq('bla-bla issue')
end
it "returns json with all needed elements" do
assignee = create(:user)
project = create(:project, :internal)
issue = create :issue, project: project, assignees: [assignee]
create(:award_emoji, :upvote, awardable: issue)
expected_hash = issue.attributes.extract!(
'id',
'iid',
'title',
'description',
'created_at',
'updated_at',
'project_id',
'author_id',
'confidential'
).merge({
'type' => issue.es_type,
'state' => issue.state,
'upvotes' => 1
})
expected_hash['assignee_id'] = [assignee.id]
expected_hash['issues_access_level'] = ProjectFeature::ENABLED
expected_hash['visibility_level'] = Gitlab::VisibilityLevel::INTERNAL
expect(issue.__elasticsearch__.as_indexed_json).to eq(expected_hash)
context 'json' do
let_it_be(:assignee) { create(:user) }
let_it_be(:group) { create(:group) }
let_it_be(:subgroup) { create(:group, parent: group) }
let_it_be(:project) { create(:project, :internal, namespace: subgroup) }
let_it_be(:issue) { create(:issue, project: project, assignees: [assignee]) }
let_it_be(:award_emoji) { create(:award_emoji, :upvote, awardable: issue) }
context 'when add_namespace_ancestry_to_issues_mapping migration is not done' do
before do
set_elasticsearch_migration_to :add_namespace_ancestry_to_issues_mapping, including: false
end
it "returns json without namespace_ancestry" do
expect(issue.__elasticsearch__.as_indexed_json.keys).not_to include('namespace_ancestry')
end
end
it "returns json with all needed elements" do
expected_hash = issue.attributes.extract!(
'id',
'iid',
'title',
'description',
'created_at',
'updated_at',
'project_id',
'author_id',
'confidential'
).merge({
'type' => issue.es_type,
'state' => issue.state,
'upvotes' => 1,
'namespace_ancestry' => "#{group.id}-#{subgroup.id}"
})
expected_hash['assignee_id'] = [assignee.id]
expected_hash['issues_access_level'] = ProjectFeature::ENABLED
expected_hash['visibility_level'] = Gitlab::VisibilityLevel::INTERNAL
expect(issue.__elasticsearch__.as_indexed_json).to eq(expected_hash)
end
end
it 'handles a project missing project_feature', :aggregate_failures do
......
......@@ -45,7 +45,7 @@ RSpec.describe Groups::TransferService, '#execute' do
create(:elasticsearch_indexed_namespace, namespace: new_group)
end
it 'invalidates the cache and indexes the project and associated issues only' do
it 'invalidates the cache and indexes the project and all associated data' do
expect(project).not_to receive(:maintain_elasticsearch_update)
expect(project).not_to receive(:maintain_elasticsearch_destroy)
expect(::Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project)
......@@ -57,27 +57,22 @@ RSpec.describe Groups::TransferService, '#execute' do
end
context 'when elasticsearch_limit_indexing is off' do
context 'when visibility changes' do
let(:new_group) { create(:group, :private) }
it 'does not invalidate the cache and reindexes projects and associated issues, merge_requests and notes' do
project1 = create(:project, :repository, :public, namespace: group)
project2 = create(:project, :repository, :public, namespace: group)
project3 = create(:project, :repository, :private, namespace: group)
expect(::Gitlab::CurrentSettings).not_to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(project1)
expect(ElasticAssociationIndexerWorker).to receive(:perform_async).with('Project', project1.id, %w[issues merge_requests notes])
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(project2)
expect(ElasticAssociationIndexerWorker).to receive(:perform_async).with('Project', project2.id, %w[issues merge_requests notes])
expect(Elastic::ProcessBookkeepingService).not_to receive(:track!).with(project3)
expect(ElasticAssociationIndexerWorker).not_to receive(:perform_async).with('Project', project3.id, %w[issues merge_requests notes])
let(:new_group) { create(:group, :private) }
transfer_service.execute(new_group)
it 'does not invalidate the cache and reindexes projects and associated data' do
project1 = create(:project, :repository, :public, namespace: group)
project2 = create(:project, :repository, :public, namespace: group)
project3 = create(:project, :repository, :private, namespace: group)
expect(transfer_service.error).not_to be
expect(group.parent).to eq(new_group)
end
expect(::Gitlab::CurrentSettings).not_to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
expect(::Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project1)
expect(::Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project2)
expect(::Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project3)
transfer_service.execute(new_group)
expect(transfer_service.error).not_to be
expect(group.parent).to eq(new_group)
end
end
end
......
......@@ -70,17 +70,6 @@ RSpec.describe Projects::TransferService do
stub_ee_application_setting(elasticsearch_indexing: true)
end
context 'when visibility level changes' do
let_it_be(:group) { create(:group, :private) }
it 'reindexes the project and associated issues and notes' do
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(project)
expect(ElasticAssociationIndexerWorker).to receive(:perform_async).with('Project', project.id, %w[issues merge_requests notes])
subject.execute(group)
end
end
context 'when elasticsearch_limit_indexing is on' do
before do
stub_ee_application_setting(elasticsearch_limit_indexing: true)
......@@ -93,7 +82,6 @@ RSpec.describe Projects::TransferService do
it 'invalidates the cache and indexes the project and all associated data' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project)
expect(project).not_to receive(:maintain_elasticsearch_destroy)
expect(::Gitlab::CurrentSettings).to receive(:invalidate_elasticsearch_indexes_cache_for_project!).with(project.id).and_call_original
subject.execute(group)
......@@ -106,9 +94,8 @@ RSpec.describe Projects::TransferService do
create(:elasticsearch_indexed_namespace, namespace: project.namespace)
end
it 'does not invalidate the cache does not index or delete anything' do
expect(Elastic::ProcessInitialBookkeepingService).not_to receive(:backfill_projects!).with(project)
expect(project).not_to receive(:maintain_elasticsearch_destroy)
it 'does not invalidate the cache and indexes the project and associated data' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project)
expect(::Gitlab::CurrentSettings).not_to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
subject.execute(group)
......@@ -117,10 +104,9 @@ RSpec.describe Projects::TransferService do
end
context 'when elasticsearch_limit_indexing is off' do
it 'does not invalidate the cache and reindexes the project only' do
expect(Elastic::ProcessBookkeepingService).to receive(:track!).with(project)
expect(ElasticAssociationIndexerWorker).not_to receive(:perform_async)
expect(::Gitlab::CurrentSettings).not_to receive(:invalidate_elasticsearch_indexes_cache_for_project!).with(project.id).and_call_original
it 'does not invalidate the cache and indexes the project and all associated data' do
expect(Elastic::ProcessInitialBookkeepingService).to receive(:backfill_projects!).with(project)
expect(::Gitlab::CurrentSettings).not_to receive(:invalidate_elasticsearch_indexes_cache_for_project!)
subject.execute(group)
end
......
......@@ -12065,6 +12065,9 @@ msgstr ""
msgid "Edit Group Hook"
msgstr ""
msgid "Edit Identity"
msgstr ""
msgid "Edit Label"
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment