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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
47b01f59
Commit
47b01f59
authored
Apr 06, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for after_destroy :redis_delete_data hook
parent
a79cbbd8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
spec/models/ci/job_trace_chunk_spec.rb
spec/models/ci/job_trace_chunk_spec.rb
+61
-0
No files found.
spec/models/ci/job_trace_chunk_spec.rb
View file @
47b01f59
...
...
@@ -316,4 +316,65 @@ describe Ci::JobTraceChunk, :clean_gitlab_redis_shared_state do
end
end
end
describe
'deletes data in redis after chunk record destroyed'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
end
shared_examples_for
'deletes all job_trace_chunk and data in redis'
do
it
do
project
.
builds
.
each
do
|
build
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
scan_each
(
match:
"gitlab:ci:trace:
#{
build
.
id
}
:chunks:?"
)
do
|
key
|
expect
(
redis
.
exists
(
key
)).
to
be_truthy
end
end
end
expect
(
described_class
.
count
).
not_to
eq
(
0
)
subject
expect
(
described_class
.
count
).
to
eq
(
0
)
project
.
builds
.
each
do
|
build
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
redis
.
scan_each
(
match:
"gitlab:ci:trace:
#{
build
.
id
}
:chunks:?"
)
do
|
key
|
expect
(
redis
.
exists
(
key
)).
to
be_falsey
end
end
end
end
end
context
'when job_trace_chunk is destroyed'
do
let
(
:subject
)
do
project
.
builds
.
each
{
|
build
|
build
.
chunks
.
destroy_all
}
end
it_behaves_like
'deletes all job_trace_chunk and data in redis'
end
context
'when job is destroyed'
do
let
(
:subject
)
do
project
.
builds
.
destroy_all
end
it_behaves_like
'deletes all job_trace_chunk and data in redis'
end
context
'when project is destroyed'
do
let
(
:subject
)
do
project
.
destroy!
end
it_behaves_like
'deletes all job_trace_chunk and data in redis'
end
end
end
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