diff options
Diffstat (limited to 'spec/factories/ci')
-rw-r--r-- | spec/factories/ci/build_pending_states.rb | 2 | ||||
-rw-r--r-- | spec/factories/ci/build_trace_chunks.rb | 13 | ||||
-rw-r--r-- | spec/factories/ci/pipelines.rb | 2 |
3 files changed, 15 insertions, 2 deletions
diff --git a/spec/factories/ci/build_pending_states.rb b/spec/factories/ci/build_pending_states.rb index 765b7f005b9..eddd74b1068 100644 --- a/spec/factories/ci/build_pending_states.rb +++ b/spec/factories/ci/build_pending_states.rb @@ -3,7 +3,7 @@ FactoryBot.define do factory :ci_build_pending_state, class: 'Ci::BuildPendingState' do build factory: :ci_build - trace_checksum { 'crc32:12345678' } + trace_checksum { 'crc32:bc614e' } state { 'success' } end end diff --git a/spec/factories/ci/build_trace_chunks.rb b/spec/factories/ci/build_trace_chunks.rb index 7c348f4b7e4..d996b41b648 100644 --- a/spec/factories/ci/build_trace_chunks.rb +++ b/spec/factories/ci/build_trace_chunks.rb @@ -53,5 +53,18 @@ FactoryBot.define do 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 diff --git a/spec/factories/ci/pipelines.rb b/spec/factories/ci/pipelines.rb index 6174bfbfbb7..5fec6dd0d78 100644 --- a/spec/factories/ci/pipelines.rb +++ b/spec/factories/ci/pipelines.rb @@ -23,7 +23,7 @@ FactoryBot.define do factory :ci_pipeline do transient { ci_ref_presence { true } } - after(:build) do |pipeline, evaluator| + before(:create) do |pipeline, evaluator| pipeline.ensure_ci_ref! if evaluator.ci_ref_presence && pipeline.ci_ref_id.nil? end |