2017-09-21 08:34:12 +00:00
|
|
|
include ActionDispatch::TestProcess
|
|
|
|
|
2017-12-14 00:13:44 +00:00
|
|
|
FactoryBot.define do
|
2017-09-21 08:34:12 +00:00
|
|
|
factory :ci_job_artifact, class: Ci::JobArtifact do
|
|
|
|
job factory: :ci_build
|
|
|
|
file_type :archive
|
|
|
|
|
2017-12-05 14:31:33 +00:00
|
|
|
trait :remote_store do
|
2018-02-02 13:59:43 +00:00
|
|
|
file_store JobArtifactUploader::Store::REMOTE
|
2017-12-05 14:31:33 +00:00
|
|
|
end
|
|
|
|
|
2017-11-02 11:16:50 +00:00
|
|
|
after :build do |artifact|
|
|
|
|
artifact.project ||= artifact.job.project
|
|
|
|
end
|
|
|
|
|
2017-11-23 17:51:20 +00:00
|
|
|
trait :archive do
|
2017-11-30 17:32:16 +00:00
|
|
|
file_type :archive
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
2017-12-03 15:21:59 +00:00
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts.zip'), 'application/zip')
|
2017-09-21 08:34:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2017-11-23 17:51:20 +00:00
|
|
|
trait :metadata do
|
2017-11-30 17:32:16 +00:00
|
|
|
file_type :metadata
|
|
|
|
|
|
|
|
after(:build) do |artifact, _|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/ci_build_artifacts_metadata.gz'), 'application/x-gzip')
|
2017-11-23 17:51:20 +00:00
|
|
|
end
|
2017-09-21 08:34:12 +00:00
|
|
|
end
|
2018-02-06 14:18:32 +00:00
|
|
|
|
|
|
|
trait :trace do
|
|
|
|
file_type :trace
|
|
|
|
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file = fixture_file_upload(
|
|
|
|
Rails.root.join('spec/fixtures/trace/sample_trace'), 'text/plain')
|
|
|
|
end
|
|
|
|
end
|
2018-03-06 18:46:36 +00:00
|
|
|
|
|
|
|
trait :correct_checksum do
|
|
|
|
after(:build) do |artifact, evaluator|
|
|
|
|
artifact.file_sha256 = Digest::SHA256.file(artifact.file.path).hexdigest
|
|
|
|
end
|
|
|
|
end
|
2017-09-21 08:34:12 +00:00
|
|
|
end
|
|
|
|
end
|