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,9 +79,11 @@ describe('KnativeDomainEditor', () => { ...@@ -79,9 +79,11 @@ 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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted('save')[0]).toEqual([knative.hostname]); expect(wrapper.emitted('save')[0]).toEqual([knative.hostname]);
}); });
}); });
});
describe('when knative domain name was saved successfully', () => { describe('when knative domain name was saved successfully', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -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', () =>
wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted('confirm')).toBeTruthy(); 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,8 +70,10 @@ describe('CrossplaneProviderStack component', () => { ...@@ -70,8 +70,10 @@ describe('CrossplaneProviderStack component', () => {
}; };
createComponent({ crossplane }); createComponent({ crossplane });
findFirstDropdownElement().vm.$emit('click'); findFirstDropdownElement().vm.$emit('click');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().set[0][0].code).toEqual('gcp'); 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', () => {
expect(wrapper.vm.dropdownText).toBe('Select Stack'); expect(wrapper.vm.dropdownText).toBe('Select Stack');
......
...@@ -126,8 +126,10 @@ describe('DiffFileHeader component', () => { ...@@ -126,8 +126,10 @@ 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'));
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().toggleFile).toBeDefined(); 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', () => {
createComponent({ collapsible: true }); createComponent({ collapsible: true });
...@@ -200,8 +202,10 @@ describe('DiffFileHeader component', () => { ...@@ -200,8 +202,10 @@ describe('DiffFileHeader component', () => {
addMergeRequestButtons: true, addMergeRequestButtons: true,
}); });
wrapper.find(EditButton).vm.$emit('showForkMessage'); wrapper.find(EditButton).vm.$emit('showForkMessage');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().showForkMessage).toBeDefined(); expect(wrapper.emitted().showForkMessage).toBeDefined();
}); });
});
it('for mode_changed file mode displays mode changes', () => { it('for mode_changed file mode displays mode changes', () => {
createComponent({ createComponent({
......
...@@ -65,8 +65,10 @@ describe('IDE pipeline stage', () => { ...@@ -65,8 +65,10 @@ describe('IDE pipeline stage', () => {
.findAll(Item) .findAll(Item)
.at(0) .at(0)
.vm.$emit('clickViewLog', job); .vm.$emit('clickViewLog', job);
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().clickViewLog[0][0]).toBe(job); expect(wrapper.emitted().clickViewLog[0][0]).toBe(job);
}); });
});
it('renders stage details & icon', () => { it('renders stage details & icon', () => {
createComponent(); createComponent();
......
...@@ -119,19 +119,28 @@ describe('DiscussionNotes', () => { ...@@ -119,19 +119,28 @@ 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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy(); 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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().startReplying).toBeTruthy(); 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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy(); expect(wrapper.emitted().deleteNote).toBeTruthy();
}); });
}); });
});
describe('with ungroupped notes', () => { describe('with ungroupped notes', () => {
let note; let note;
...@@ -142,10 +151,13 @@ describe('DiscussionNotes', () => { ...@@ -142,10 +151,13 @@ 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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().deleteNote).toBeTruthy(); expect(wrapper.emitted().deleteNote).toBeTruthy();
}); });
}); });
}); });
});
describe('componentData', () => { describe('componentData', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -118,9 +118,11 @@ describe('Repository last commit component', () => { ...@@ -118,9 +118,11 @@ describe('Repository last commit component', () => {
vm.find('.text-expander').vm.$emit('click'); vm.find('.text-expander').vm.$emit('click');
return vm.vm.$nextTick().then(() => {
expect(vm.find('.commit-row-description').isVisible()).toBe(true); expect(vm.find('.commit-row-description').isVisible()).toBe(true);
expect(vm.find('.text-expander').classes('open')).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', () => {
factory(createCommitData({ signatureHtml: '<button>Verified</button>' })); factory(createCommitData({ signatureHtml: '<button>Verified</button>' }));
......
...@@ -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');
return wrapper.vm.$nextTick().then(() => {
expect(wrapper.emitted().input[0]).toEqual(['Update test.txt']); 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