Commit b93992b0 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'research_limiting_number_of_queries' into 'master'

Lower spec bar for number of sql queries

See merge request gitlab-org/gitlab!64633
parents c1935190 11e8df41
...@@ -1870,9 +1870,10 @@ class User < ApplicationRecord ...@@ -1870,9 +1870,10 @@ class User < ApplicationRecord
end end
def password_expired_if_applicable? def password_expired_if_applicable?
return false unless password_expired?
return false unless allow_password_authentication? return false unless allow_password_authentication?
password_expired? true
end end
def can_be_deactivated? def can_be_deactivated?
......
...@@ -68,7 +68,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do ...@@ -68,7 +68,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do
context 'when the current user does not have permission to add assignees' do context 'when the current user does not have permission to add assignees' do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
let(:db_query_limit) { 28 } let(:db_query_limit) { 27 }
it 'does not change the assignees' do it 'does not change the assignees' do
project.add_guest(current_user) project.add_guest(current_user)
...@@ -80,7 +80,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do ...@@ -80,7 +80,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do
end end
context 'with assignees already assigned' do context 'with assignees already assigned' do
let(:db_query_limit) { 46 } let(:db_query_limit) { 39 }
before do before do
merge_request.assignees = [assignee2] merge_request.assignees = [assignee2]
...@@ -96,7 +96,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do ...@@ -96,7 +96,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do
end end
context 'when passing an empty list of assignees' do context 'when passing an empty list of assignees' do
let(:db_query_limit) { 32 } let(:db_query_limit) { 31 }
let(:input) { { assignee_usernames: [] } } let(:input) { { assignee_usernames: [] } }
before do before do
...@@ -115,7 +115,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do ...@@ -115,7 +115,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do
context 'when passing append as true' do context 'when passing append as true' do
let(:mode) { Types::MutationOperationModeEnum.enum[:append] } let(:mode) { Types::MutationOperationModeEnum.enum[:append] }
let(:input) { { assignee_usernames: [assignee2.username], operation_mode: mode } } let(:input) { { assignee_usernames: [assignee2.username], operation_mode: mode } }
let(:db_query_limit) { 22 } let(:db_query_limit) { 21 }
before do before do
# In CE, APPEND is a NOOP as you can't have multiple assignees # In CE, APPEND is a NOOP as you can't have multiple assignees
...@@ -135,7 +135,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do ...@@ -135,7 +135,7 @@ RSpec.describe 'Setting assignees of a merge request', :assume_throttled do
end end
context 'when passing remove as true' do context 'when passing remove as true' do
let(:db_query_limit) { 32 } let(:db_query_limit) { 31 }
let(:mode) { Types::MutationOperationModeEnum.enum[:remove] } let(:mode) { Types::MutationOperationModeEnum.enum[:remove] }
let(:input) { { assignee_usernames: [assignee.username], operation_mode: mode } } let(:input) { { assignee_usernames: [assignee.username], operation_mode: mode } }
let(:expected_result) { [] } let(:expected_result) { [] }
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe API::ImportBitbucketServer do RSpec.describe API::ImportBitbucketServer do
let(:base_uri) { "https://test:7990" } let(:base_uri) { "https://test:7990" }
let(:user) { create(:user, bio: 'test') } let(:user) { create(:user) }
let(:token) { "asdasd12345" } let(:token) { "asdasd12345" }
let(:secret) { "sekrettt" } let(:secret) { "sekrettt" }
let(:project_key) { 'TES' } let(:project_key) { 'TES' }
......
...@@ -76,7 +76,7 @@ RSpec.describe Repositories::ChangelogService do ...@@ -76,7 +76,7 @@ RSpec.describe Repositories::ChangelogService do
recorder = ActiveRecord::QueryRecorder.new { service.execute } recorder = ActiveRecord::QueryRecorder.new { service.execute }
changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data changelog = project.repository.blob_at('master', 'CHANGELOG.md')&.data
expect(recorder.count).to eq(12) expect(recorder.count).to eq(11)
expect(changelog).to include('Title 1', 'Title 2') expect(changelog).to include('Title 1', 'Title 2')
end end
......
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