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
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 00:09:21 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-17 00:09:21 +0300
commit87af6f2e0590af0ed1bb3e5de1bb5d21855a94d2 (patch)
tree2abe2661b10cf6281bc03855b3053a072c64fbbf /spec/lib/gitlab/diff
parentc43ba2677f41ad0b5fc6f3af6baf4266c70dfcb3 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/diff')
-rw-r--r--spec/lib/gitlab/diff/highlight_cache_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/gitlab/diff/highlight_cache_spec.rb b/spec/lib/gitlab/diff/highlight_cache_spec.rb
index 457e81bc95f..a16e5e185bb 100644
--- a/spec/lib/gitlab/diff/highlight_cache_spec.rb
+++ b/spec/lib/gitlab/diff/highlight_cache_spec.rb
@@ -97,6 +97,28 @@ describe Gitlab::Diff::HighlightCache, :clean_gitlab_redis_cache do
let(:paths) { merge_request.diffs.raw_diff_files.select(&:text?).map(&:file_path) }
end
+ it 'updates memory usage metrics if Redis version >= 4' do
+ allow_next_instance_of(Redis) do |redis|
+ allow(redis).to receive(:info).and_return({ "redis_version" => "4.0.0" })
+
+ expect(described_class.gitlab_redis_diff_caching_memory_usage_bytes)
+ .to receive(:observe).and_call_original
+
+ cache.send(:write_to_redis_hash, diff_hash)
+ end
+ end
+
+ it 'does not update memory usage metrics if Redis version < 4' do
+ allow_next_instance_of(Redis) do |redis|
+ allow(redis).to receive(:info).and_return({ "redis_version" => "3.0.0" })
+
+ expect(described_class.gitlab_redis_diff_caching_memory_usage_bytes)
+ .not_to receive(:observe).and_call_original
+
+ cache.send(:write_to_redis_hash, diff_hash)
+ end
+ end
+
context 'different diff_collections for the same diffable' do
before do
cache.write_if_empty