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 ...@@ -37,7 +37,7 @@ module Gitlab
def find_by_path(query) def find_by_path(query)
search_paths(query).map do |path| 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
end end
......
...@@ -79,7 +79,9 @@ describe('KnativeDomainEditor', () => { ...@@ -79,7 +79,9 @@ describe('KnativeDomainEditor', () => {
it('triggers save event and pass current knative hostname', () => { it('triggers save event and pass current knative hostname', () => {
wrapper.find(LoadingButton).vm.$emit('click'); 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', () => { ...@@ -35,9 +35,10 @@ describe('UninstallApplicationConfirmationModal', () => {
wrapper.find(GlModal).vm.$emit('ok'); wrapper.find(GlModal).vm.$emit('ok');
}); });
it('emits confirm event', () => { it('emits confirm event', () =>
expect(wrapper.emitted('confirm')).toBeTruthy(); wrapper.vm.$nextTick().then(() => {
}); expect(wrapper.emitted('confirm')).toBeTruthy();
}));
it('calls track uninstall button click mixin', () => { it('calls track uninstall button click mixin', () => {
expect(wrapper.vm.trackUninstallButtonClick).toHaveBeenCalledWith(INGRESS); expect(wrapper.vm.trackUninstallButtonClick).toHaveBeenCalledWith(INGRESS);
......
...@@ -70,7 +70,9 @@ describe('CrossplaneProviderStack component', () => { ...@@ -70,7 +70,9 @@ describe('CrossplaneProviderStack component', () => {
}; };
createComponent({ crossplane }); createComponent({ crossplane });
findFirstDropdownElement().vm.$emit('click'); 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', () => { it('renders the correct dropdown text when no stack is selected', () => {
......
...@@ -126,7 +126,9 @@ describe('DiffFileHeader component', () => { ...@@ -126,7 +126,9 @@ describe('DiffFileHeader component', () => {
it('when collapseIcon is clicked emits toggleFile', () => { it('when collapseIcon is clicked emits toggleFile', () => {
createComponent({ collapsible: true }); createComponent({ collapsible: true });
findCollapseIcon().vm.$emit('click', new Event('click')); 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', () => { it('when other element in header is clicked does not emits toggleFile', () => {
...@@ -200,7 +202,9 @@ describe('DiffFileHeader component', () => { ...@@ -200,7 +202,9 @@ describe('DiffFileHeader component', () => {
addMergeRequestButtons: true, addMergeRequestButtons: true,
}); });
wrapper.find(EditButton).vm.$emit('showForkMessage'); 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', () => { it('for mode_changed file mode displays mode changes', () => {
......
...@@ -65,7 +65,9 @@ describe('IDE pipeline stage', () => { ...@@ -65,7 +65,9 @@ describe('IDE pipeline stage', () => {
.findAll(Item) .findAll(Item)
.at(0) .at(0)
.vm.$emit('clickViewLog', job); .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', () => { it('renders stage details & icon', () => {
......
...@@ -119,17 +119,26 @@ describe('DiscussionNotes', () => { ...@@ -119,17 +119,26 @@ describe('DiscussionNotes', () => {
it('emits deleteNote when first note emits handleDeleteNote', () => { it('emits deleteNote when first note emits handleDeleteNote', () => {
findNoteAtIndex(0).vm.$emit('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', () => { it('emits startReplying when first note emits startReplying', () => {
findNoteAtIndex(0).vm.$emit('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', () => { it('emits deleteNote when second note emits handleDeleteNote', () => {
findNoteAtIndex(1).vm.$emit('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', () => { ...@@ -142,7 +151,10 @@ describe('DiscussionNotes', () => {
it('emits deleteNote when first note emits handleDeleteNote', () => { it('emits deleteNote when first note emits handleDeleteNote', () => {
note.vm.$emit('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', () => { ...@@ -118,8 +118,10 @@ describe('Repository last commit component', () => {
vm.find('.text-expander').vm.$emit('click'); vm.find('.text-expander').vm.$emit('click');
expect(vm.find('.commit-row-description').isVisible()).toBe(true); return vm.vm.$nextTick().then(() => {
expect(vm.find('.text-expander').classes('open')).toBe(true); 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', () => { it('renders the signature HTML as returned by the backend', () => {
......
...@@ -56,6 +56,8 @@ describe('Commits message dropdown component', () => { ...@@ -56,6 +56,8 @@ describe('Commits message dropdown component', () => {
it('should emit a commit title on selecting commit', () => { it('should emit a commit title on selecting commit', () => {
findFirstDropdownElement().vm.$emit('click'); 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 ...@@ -30,5 +30,11 @@ describe Gitlab::FileFinder do
expect(results.count).to eq(1) expect(results.count).to eq(1)
end 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
end end
...@@ -86,8 +86,7 @@ describe Gitlab::ProjectSearchResults do ...@@ -86,8 +86,7 @@ describe Gitlab::ProjectSearchResults do
it "loads all blobs for path matches in single batch" do it "loads all blobs for path matches in single batch" do
expect(Gitlab::Git::Blob).to receive(:batch).once.and_call_original expect(Gitlab::Git::Blob).to receive(:batch).once.and_call_original
expected = project.repository.search_files_by_name(query, 'master') results.map(&:data)
expect(results.map(&:path)).to include(*expected)
end end
it 'finds by content' do 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