diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2015-12-30 15:21:05 +0100 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-01-14 12:48:14 +0100 |
commit | ad5302ba155725f2438e0c53e977f16aba32242a (patch) | |
tree | 822386087f54e275b20a94ba223413bfdef8f29b /db | |
parent | 662f4b9e1dec8e461c4ea8da3ccc46a259d9d205 (diff) | |
download | gitlab-ce-ad5302ba155725f2438e0c53e977f16aba32242a.tar.gz |
Seed db on development with artifacts metadata fixture
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/14_builds.rb | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/db/fixtures/development/14_builds.rb b/db/fixtures/development/14_builds.rb index f86fff0692e..03a12323845 100644 --- a/db/fixtures/development/14_builds.rb +++ b/db/fixtures/development/14_builds.rb @@ -9,11 +9,14 @@ class Gitlab::Seeder::Builds ci_commits.each do |ci_commit| build = Ci::Build.new(build_attributes_for(ci_commit)) - FileUtils.copy(artifacts_path, artifacts_cache_file_path) - File.open(artifacts_cache_file_path, 'r') do |file| + artifacts_cache_file(artifacts_archive_path) do |file| build.artifacts_file = file end + artifacts_cache_file(artifacts_metadata_path) do |file| + build.artifacts_metadata = file + end + begin build.save! print '.' @@ -49,12 +52,22 @@ class Gitlab::Seeder::Builds BUILD_STATUSES.sample end - def artifacts_path + def artifacts_archive_path Rails.root + 'spec/fixtures/ci_build_artifacts.zip' end - def artifacts_cache_file_path - artifacts_path.to_s.gsub('ci_', "p#{@project.id}_") + def artifacts_metadata_path + Rails.root + 'spec/fixtures/ci_build_artifacts_metadata.gz' + + end + + def artifacts_cache_file(file_path) + cache_path = file_path.to_s.gsub('ci_', "p#{@project.id}_") + + FileUtils.copy(file_path, cache_path) + File.open(cache_path) do |file| + yield file + end end end |