2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
FactoryBot.define do
|
2020-03-13 15:44:24 +05:30
|
|
|
factory :ci_build_trace_chunk, class: 'Ci::BuildTraceChunk' do
|
2018-10-15 14:42:47 +05:30
|
|
|
build factory: :ci_build
|
2021-04-17 20:07:23 +05:30
|
|
|
chunk_index { generate(:iid) }
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :redis }
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
trait :redis_with_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :redis }
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
transient do
|
2019-12-21 20:55:43 +05:30
|
|
|
initial_data { 'test data' }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |build_trace_chunk, evaluator|
|
|
|
|
Ci::BuildTraceChunks::Redis.new.set_data(build_trace_chunk, evaluator.initial_data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :redis_without_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :redis }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :database_with_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :database}
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
transient do
|
2019-12-21 20:55:43 +05:30
|
|
|
initial_data { 'test data' }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |build_trace_chunk, evaluator|
|
|
|
|
Ci::BuildTraceChunks::Database.new.set_data(build_trace_chunk, evaluator.initial_data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :database_without_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :database }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
trait :fog_with_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :fog }
|
2018-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
transient do
|
2019-12-21 20:55:43 +05:30
|
|
|
initial_data { 'test data' }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
after(:create) do |build_trace_chunk, evaluator|
|
|
|
|
Ci::BuildTraceChunks::Fog.new.set_data(build_trace_chunk, evaluator.initial_data)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
trait :fog_without_data do
|
2019-12-21 20:55:43 +05:30
|
|
|
data_store { :fog }
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
trait :persisted do
|
|
|
|
data_store { :database}
|
|
|
|
|
|
|
|
transient do
|
|
|
|
initial_data { 'test data' }
|
|
|
|
end
|
|
|
|
|
|
|
|
after(:build) do |chunk, evaluator|
|
|
|
|
Ci::BuildTraceChunks::Database.new.set_data(chunk, evaluator.initial_data)
|
|
|
|
chunk.checksum = chunk.class.crc32(evaluator.initial_data)
|
|
|
|
end
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|