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
d6b65a4e
Commit
d6b65a4e
authored
Sep 07, 2020
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for build trace chunks flush worker
parent
680c87dd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
8 deletions
+39
-8
app/models/ci/build_trace_chunk.rb
app/models/ci/build_trace_chunk.rb
+8
-8
spec/workers/ci/build_trace_chunk_flush_worker_spec.rb
spec/workers/ci/build_trace_chunk_flush_worker_spec.rb
+31
-0
No files found.
app/models/ci/build_trace_chunk.rb
View file @
d6b65a4e
...
...
@@ -108,6 +108,14 @@ module Ci
Ci
::
BuildTraceChunkFlushWorker
.
perform_async
(
id
)
end
def
persisted?
!
redis?
end
def
live?
redis?
end
private
def
get_data
...
...
@@ -170,14 +178,6 @@ module Ci
save!
if
changed?
end
def
persisted?
!
redis?
end
def
live?
redis?
end
def
full?
size
==
CHUNK_SIZE
end
...
...
spec/workers/ci/build_trace_chunk_flush_worker_spec.rb
0 → 100644
View file @
d6b65a4e
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Ci
::
BuildTraceChunkFlushWorker
do
let
(
:data
)
{
'x'
*
Ci
::
BuildTraceChunk
::
CHUNK_SIZE
}
let
(
:chunk
)
do
create
(
:ci_build_trace_chunk
,
:redis_with_data
,
initial_data:
data
)
end
it
'migrates chunk to a permanent store'
do
expect
(
chunk
).
to
be_live
described_class
.
new
.
perform
(
chunk
.
id
)
expect
(
chunk
.
reload
).
to
be_persisted
end
describe
'#perform'
do
it_behaves_like
'an idempotent worker'
do
let
(
:job_args
)
{
[
chunk
.
id
]
}
it
'migrates build trace chunk to a safe store'
do
subject
expect
(
chunk
.
reload
).
to
be_persisted
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