Commit 4247e67b authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent c0d8f9f3
---
title: Fix slow query on blob search when doing path filtering
merge_request: 21996
author:
type: performance
---
title: Remove ActiveRecord patch to ignore limit on text columns
merge_request: 22406
author:
type: other
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
module LimitFilter
def add_column(table_name, column_name, type, options = {})
options.delete(:limit) if type == :text
super(table_name, column_name, type, options)
end
def change_column(table_name, column_name, type, options = {})
options.delete(:limit) if type == :text
super(table_name, column_name, type, options)
end
end
prepend ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::LimitFilter
class TableDefinition
def text(*args)
options = args.extract_options!
options.delete(:limit)
column_names = args
type = :text
column_names.each { |name| column(name, type, options) }
end
end
end
end
......@@ -37,7 +37,7 @@ module Gitlab
def find_by_path(query)
search_paths(query).map do |path|
Gitlab::Search::FoundBlob.new(blob_path: path, project: project, ref: ref, repository: repository)
Gitlab::Search::FoundBlob.new(blob_path: path, path: path, project: project, ref: ref, repository: repository)
end
end
......
......@@ -79,7 +79,9 @@ describe('KnativeDomainEditor', () => {
it('triggers save event and pass current knative hostname', () => {
wrapper.find(LoadingButton).vm.$emit('click');
expect(wrapper.emitted('save')[0]).toEqual([knative.hostname]);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted('save')[0]).toEqual([knative.hostname]);
});
});
});
......
......@@ -35,9 +35,10 @@ describe('UninstallApplicationConfirmationModal', () => {
wrapper.find(GlModal).vm.$emit('ok');
});
it('emits confirm event', () => {
expect(wrapper.emitted('confirm')).toBeTruthy();
});
it('emits confirm event', () =>
wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted('confirm')).toBeTruthy();
}));
it('calls track uninstall button click mixin', () => {
expect(wrapper.vm.trackUninstallButtonClick).toHaveBeenCalledWith(INGRESS);
......
......@@ -70,7 +70,9 @@ describe('CrossplaneProviderStack component', () => {
};
createComponent({ crossplane });
findFirstDropdownElement().vm.$emit('click');
expect(wrapper.emitted().set[0][0].code).toEqual('gcp');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().set[0][0].code).toEqual('gcp');
});
});
it('renders the correct dropdown text when no stack is selected', () => {
......
......@@ -126,7 +126,9 @@ describe('DiffFileHeader component', () => {
it('when collapseIcon is clicked emits toggleFile', () => {
createComponent({ collapsible: true });
findCollapseIcon().vm.$emit('click', new Event('click'));
expect(wrapper.emitted().toggleFile).toBeDefined();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().toggleFile).toBeDefined();
});
});
it('when other element in header is clicked does not emits toggleFile', () => {
......@@ -200,7 +202,9 @@ describe('DiffFileHeader component', () => {
addMergeRequestButtons: true,
});
wrapper.find(EditButton).vm.$emit('showForkMessage');
expect(wrapper.emitted().showForkMessage).toBeDefined();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().showForkMessage).toBeDefined();
});
});
it('for mode_changed file mode displays mode changes', () => {
......
......@@ -65,7 +65,9 @@ describe('IDE pipeline stage', () => {
.findAll(Item)
.at(0)
.vm.$emit('clickViewLog', job);
expect(wrapper.emitted().clickViewLog[0][0]).toBe(job);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().clickViewLog[0][0]).toBe(job);
});
});
it('renders stage details & icon', () => {
......
......@@ -119,17 +119,26 @@ describe('DiscussionNotes', () => {
it('emits deleteNote when first note emits handleDeleteNote', () => {
findNoteAtIndex(0).vm.$emit('handleDeleteNote');
expect(wrapper.emitted().deleteNote).toBeTruthy();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy();
});
});
it('emits startReplying when first note emits startReplying', () => {
findNoteAtIndex(0).vm.$emit('startReplying');
expect(wrapper.emitted().startReplying).toBeTruthy();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().startReplying).toBeTruthy();
});
});
it('emits deleteNote when second note emits handleDeleteNote', () => {
findNoteAtIndex(1).vm.$emit('handleDeleteNote');
expect(wrapper.emitted().deleteNote).toBeTruthy();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy();
});
});
});
......@@ -142,7 +151,10 @@ describe('DiscussionNotes', () => {
it('emits deleteNote when first note emits handleDeleteNote', () => {
note.vm.$emit('handleDeleteNote');
expect(wrapper.emitted().deleteNote).toBeTruthy();
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy();
});
});
});
});
......
......@@ -118,8 +118,10 @@ describe('Repository last commit component', () => {
vm.find('.text-expander').vm.$emit('click');
expect(vm.find('.commit-row-description').isVisible()).toBe(true);
expect(vm.find('.text-expander').classes('open')).toBe(true);
return vm.vm.$nextTick().then(() => {
expect(vm.find('.commit-row-description').isVisible()).toBe(true);
expect(vm.find('.text-expander').classes('open')).toBe(true);
});
});
it('renders the signature HTML as returned by the backend', () => {
......
......@@ -56,6 +56,8 @@ describe('Commits message dropdown component', () => {
it('should emit a commit title on selecting commit', () => {
findFirstDropdownElement().vm.$emit('click');
expect(wrapper.emitted().input[0]).toEqual(['Update test.txt']);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().input[0]).toEqual(['Update test.txt']);
});
});
});
......@@ -30,5 +30,11 @@ describe Gitlab::FileFinder do
expect(results.count).to eq(1)
end
it 'does not cause N+1 query' do
expect(Gitlab::GitalyClient).to receive(:call).at_most(10).times.and_call_original
subject.find(': filename:wm.svg')
end
end
end
......@@ -86,8 +86,7 @@ describe Gitlab::ProjectSearchResults do
it "loads all blobs for path matches in single batch" do
expect(Gitlab::Git::Blob).to receive(:batch).once.and_call_original
expected = project.repository.search_files_by_name(query, 'master')
expect(results.map(&:path)).to include(*expected)
results.map(&:data)
end
it 'finds by content' do
......
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