Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7fe9058c
Commit
7fe9058c
authored
Nov 21, 2019
by
Kerri Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scope tests against DeprecatedHighlightCache
parent
baedc099
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
13 deletions
+58
-13
spec/lib/gitlab/diff/file_collection/merge_request_diff_spec.rb
...ib/gitlab/diff/file_collection/merge_request_diff_spec.rb
+11
-5
spec/services/merge_requests/reload_diffs_service_spec.rb
spec/services/merge_requests/reload_diffs_service_spec.rb
+26
-5
spec/services/notes/create_service_spec.rb
spec/services/notes/create_service_spec.rb
+21
-3
No files found.
spec/lib/gitlab/diff/file_collection/merge_request_diff_spec.rb
View file @
7fe9058c
...
...
@@ -29,6 +29,11 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
let
(
:diffable
)
{
merge_request
.
merge_request_diff
}
end
context
'using Gitlab::Diff::DeprecatedHighlightCache'
do
before
do
stub_feature_flags
(
redis_diff_caching:
false
)
end
it
'uses a different cache key if diff line keys change'
do
mr_diff
=
described_class
.
new
(
merge_request
.
merge_request_diff
,
diff_options:
nil
)
key
=
mr_diff
.
cache_key
...
...
@@ -37,6 +42,7 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
expect
(
mr_diff
.
cache_key
).
not_to
eq
(
key
)
end
end
it_behaves_like
'diff statistics'
do
let
(
:collection_default_args
)
do
...
...
spec/services/merge_requests/reload_diffs_service_spec.rb
View file @
7fe9058c
...
...
@@ -33,6 +33,11 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin
end
context
'cache clearing'
do
context
'using Gitlab::Diff::DeprecatedHighlightCache'
do
before
do
stub_feature_flags
(
redis_diff_caching:
false
)
end
it
'clears the cache for older diffs on the merge request'
do
old_diff
=
merge_request
.
merge_request_diff
old_cache_key
=
old_diff
.
diffs_collection
.
cache_key
...
...
@@ -41,6 +46,22 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin
subject
.
execute
end
end
context
'using Gitlab::Diff::HighlightCache'
do
before
do
stub_feature_flags
(
redis_diff_caching:
true
)
end
it
'clears the cache for older diffs on the merge request'
do
old_diff
=
merge_request
.
merge_request_diff
old_cache_key
=
old_diff
.
diffs_collection
.
cache_key
expect_any_instance_of
(
Redis
).
to
receive
(
:del
).
with
(
old_cache_key
).
and_call_original
subject
.
execute
end
end
it
'avoids N+1 queries'
,
:request_store
do
current_user
...
...
spec/services/notes/create_service_spec.rb
View file @
7fe9058c
...
...
@@ -87,11 +87,29 @@ describe Notes::CreateService do
.
to
receive
(
:unfolded_diff?
)
{
true
}
end
context
'using Gitlab::Diff::DeprecatedHighlightCache'
do
before
do
stub_feature_flags
(
redis_diff_caching:
false
)
end
it
'clears noteable diff cache when it was unfolded for the note position'
do
expect_any_instance_of
(
Gitlab
::
Diff
::
DeprecatedHighlightCache
).
to
receive
(
:clear
)
described_class
.
new
(
project_with_repo
,
user
,
new_opts
).
execute
end
end
context
'using Gitlab::Diff::HighlightCache'
do
before
do
stub_feature_flags
(
redis_diff_caching:
true
)
end
it
'clears noteable diff cache when it was unfolded for the note position'
do
expect_any_instance_of
(
Gitlab
::
Diff
::
HighlightCache
).
to
receive
(
:clear
)
described_class
.
new
(
project_with_repo
,
user
,
new_opts
).
execute
end
end
it
'does not clear cache when note is not the first of the discussion'
do
prev_note
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment