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
d5344617
Commit
d5344617
authored
Apr 30, 2018
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix spec when parent record is destroyed
parent
23c8e198
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
18 deletions
+9
-18
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+1
-1
spec/models/ci/build_trace_chunk_spec.rb
spec/models/ci/build_trace_chunk_spec.rb
+8
-17
No files found.
app/models/ci/build_trace_chunk.rb
View file @
d5344617
...
@@ -125,7 +125,7 @@ module Ci
...
@@ -125,7 +125,7 @@ module Ci
end
end
def
redis_data_key
def
redis_data_key
"gitlab:ci:trace:
#{
build_id
}
:chunks:
#{
chunk_index
}
:data
"
"gitlab:ci:trace:
#{
build_id
}
:chunks:
#{
chunk_index
}
"
end
end
def
redis_lock_key
def
redis_lock_key
...
...
spec/models/ci/build_trace_chunk_spec.rb
View file @
d5344617
...
@@ -332,25 +332,20 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -332,25 +332,20 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
end
end
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
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
before
do
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
@build_ids
=
[]
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
)
@build_ids
<<
create
(
:ci_build
,
:running
,
:trace_live
,
pipeline:
pipeline
,
project:
project
).
id
end
end
shared_examples_for
'deletes all build_trace_chunk and data in redis'
do
shared_examples_for
'deletes all build_trace_chunk and data in redis'
do
it
do
it
do
@build_ids
.
each
do
|
build_id
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
3
)
redis
.
scan_each
(
match:
"gitlab:ci:trace:
#{
build_id
}
:chunks:?"
)
do
|
key
|
expect
(
redis
.
exists
(
key
)).
to
be_truthy
end
end
end
end
expect
(
described_class
.
count
).
to
eq
(
3
)
expect
(
described_class
.
count
).
to
eq
(
3
)
...
@@ -359,12 +354,8 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
...
@@ -359,12 +354,8 @@ describe Ci::BuildTraceChunk, :clean_gitlab_redis_shared_state do
expect
(
described_class
.
count
).
to
eq
(
0
)
expect
(
described_class
.
count
).
to
eq
(
0
)
@build_ids
.
each
do
|
build_id
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
Gitlab
::
Redis
::
SharedState
.
with
do
|
redis
|
expect
(
redis
.
scan_each
(
match:
"gitlab:ci:trace:?:chunks:?"
).
to_a
.
count
).
to
eq
(
0
)
redis
.
scan_each
(
match:
"gitlab:ci:trace:
#{
build_id
}
:chunks:?"
)
do
|
key
|
expect
(
redis
.
exists
(
key
)).
to
be_falsey
end
end
end
end
end
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