Commit d6b65a4e authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add specs for build trace chunks flush worker

parent 680c87dd
......@@ -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
......
# 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment