summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-06-03 15:04:47 +0900
committerShinya Maeda <shinya@gitlab.com>2018-06-04 14:14:20 +0900
commitbcd664f53a4009bc752fbc47e1c4d6f76c0b8cc2 (patch)
treebf5371ebe3e97e68cb0a8b84680bf32657cbfc12 /spec/support
parent0d00d02e842a0c4b22d213e00143a08d97597000 (diff)
downloadgitlab-ce-bcd664f53a4009bc752fbc47e1c4d6f76c0b8cc2.tar.gz
Fix specs. Rename migration file name which was conflicted with background migration's.
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/trace/trace_helpers.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/support/trace/trace_helpers.rb b/spec/support/trace/trace_helpers.rb
new file mode 100644
index 00000000000..f6d11b61038
--- /dev/null
+++ b/spec/support/trace/trace_helpers.rb
@@ -0,0 +1,23 @@
+module TraceHelpers
+ def create_legacy_trace(build, content)
+ File.open(legacy_trace_path(build), 'wb') { |stream| stream.write(content) }
+ end
+
+ def legacy_trace_path(build)
+ legacy_trace_dir = File.join(Settings.gitlab_ci.builds_path,
+ build.created_at.utc.strftime("%Y_%m"),
+ build.project_id.to_s)
+
+ FileUtils.mkdir_p(legacy_trace_dir)
+
+ File.join(legacy_trace_dir, "#{build.id}.log")
+ end
+
+ def archived_trace_path(job_artifact)
+ disk_hash = Digest::SHA2.hexdigest(job_artifact.project_id.to_s)
+ creation_date = job_artifact.created_at.utc.strftime('%Y_%m_%d')
+
+ File.join(Gitlab.config.artifacts.path, disk_hash[0..1], disk_hash[2..3], disk_hash,
+ creation_date, job_artifact.job_id.to_s, job_artifact.id.to_s, 'job.log')
+ end
+end