Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
82787e76a87c
Commit
8b422649
authored
Apr 30, 2018
by
Shinya Maeda
Browse files
Merge branch 'live-trace-v2' into live-trace-v2-efficient-destroy-all
parents
86284821be9f
a5dfa9ca9caf
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/ci/build_trace_chunk.rb
View file @
82787e76
...
...
@@ -147,7 +147,7 @@ def redis_delete_data
end
def
redis_data_key
"gitlab:ci:trace:
#{
build_id
}
:chunks:
#{
chunk_index
}
:data
"
"gitlab:ci:trace:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
end
def
redis_lock_key
...
...
spec/models/ci/build_trace_chunk_spec.rb
View file @
82787e76
...
...
@@ -332,25 +332,20 @@
end
end
describe
'deletes data in redis after
chunk
record destroyed'
do
describe
'deletes data in redis after
a parent
record destroyed'
do
let
(
:project
)
{
create
(
:project
)
}
before
do
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
@build_ids
=
[]
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
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 build_trace_chunk and data in redis'
do
it
do
@build_ids
.
each
do
|
build_id
|
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
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
3
)
end
expect
(
described_class
.
count
).
to
eq
(
3
)
...
...
@@ -359,12 +354,8 @@
expect
(
described_class
.
count
).
to
eq
(
0
)
@build_ids
.
each
do
|
build_id
|
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
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
0
)
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