blob: 56d8fc232221af17c879987508647d4cb00b36e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# frozen_string_literal: true
FactoryBot.define do
factory :ci_build_trace_chunk, class: 'Ci::BuildTraceChunk' do
build factory: :ci_build
chunk_index { generate(:iid) }
data_store { :redis }
trait :redis_with_data do
data_store { :redis }
transient do
initial_data { 'test data' }
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
data_store { :redis }
end
trait :redis_trace_chunks_with_data do
data_store { :redis_trace_chunks }
transient do
initial_data { 'test data' }
end
after(:create) do |build_trace_chunk, evaluator|
Ci::BuildTraceChunks::RedisTraceChunks.new.set_data(build_trace_chunk, evaluator.initial_data)
end
end
trait :redis_trace_chunks_without_data do
data_store { :redis_trace_chunks }
end
trait :database_with_data do
data_store { :database }
transient do
initial_data { 'test data' }
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
data_store { :database }
end
trait :fog_with_data do
data_store { :fog }
transient do
initial_data { 'test data' }
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
data_store { :fog }
end
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
end
end
|