Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-07-24 21:08:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-07-24 21:08:45 +0300
commit2ae564d6f59fc939bfdbb155d445efe97b34c1e1 (patch)
tree106ebc2021d84757ca03610747a60c8f47ac9fb0 /spec/lib
parent7308ec9d13fb69018200a40f287e76ef499ed47c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb30
-rw-r--r--spec/lib/gitlab_settings/options_spec.rb16
2 files changed, 40 insertions, 6 deletions
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index 9ce8a674146..9c7f393490e 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -306,6 +306,36 @@ RSpec.describe Gitlab::Git::Repository, feature_category: :source_code_managemen
subject
end
+
+ context 'when repository_size does not match repository_info' do
+ before do
+ allow(repository.gitaly_repository_client).to receive(:repository_size).and_return(0)
+ allow(repository.gitaly_repository_client).to receive(:repository_info).and_return(
+ Gitaly::RepositoryInfoResponse.new(size: 1.megabytes)
+ )
+ end
+
+ it 'logs the difference' do
+ expect(Gitlab::AppJsonLogger).to receive(:info).with(
+ message: "Discrepancy between RepositorySize and RepositoryInfo",
+ repository_size_megabytes: 0.0,
+ repository_info_megabytes: 1.0,
+ project_id: project.id
+ ).and_call_original
+ subject
+ end
+
+ context 'when the log_discrepancies_repository_info_for_repository_size flag is disabled' do
+ before do
+ stub_feature_flags(log_discrepancies_repository_info_for_repository_size: false)
+ end
+
+ it 'does not log' do
+ expect(Gitlab::AppJsonLogger).not_to receive(:info)
+ subject
+ end
+ end
+ end
end
end
diff --git a/spec/lib/gitlab_settings/options_spec.rb b/spec/lib/gitlab_settings/options_spec.rb
index abb895032c9..6a53b005025 100644
--- a/spec/lib/gitlab_settings/options_spec.rb
+++ b/spec/lib/gitlab_settings/options_spec.rb
@@ -12,9 +12,11 @@ RSpec.describe GitlabSettings::Options, :aggregate_failures, feature_category: :
it 'returns the unchanged internal hash' do
stub_rails_env('production')
- expect(Gitlab::ErrorTracking)
- .to receive(:track_and_raise_for_dev_exception)
- .with(RuntimeError.new("Warning: Do not mutate GitlabSettings::Options objects: `#{method}`"), method: method)
+ expect(Gitlab::AppJsonLogger)
+ .to receive(:warn)
+ .with(hash_including(
+ message: "Warning: Do not mutate GitlabSettings::Options objects: `#{method}`",
+ method: method))
.and_call_original
expect(options.send(method)).to be_truthy
@@ -234,9 +236,11 @@ RSpec.describe GitlabSettings::Options, :aggregate_failures, feature_category: :
it 'delegates the method to the internal options hash' do
stub_rails_env('production')
- expect(Gitlab::ErrorTracking)
- .to receive(:track_and_raise_for_dev_exception)
- .with(RuntimeError.new('Calling a hash method on GitlabSettings::Options: `delete`'), method: :delete)
+ expect(Gitlab::AppJsonLogger)
+ .to receive(:warn)
+ .with(hash_including(
+ message: 'Calling a hash method on GitlabSettings::Options: `delete`',
+ method: :delete))
.and_call_original
expect { options.foo.delete('bar') }