diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-08-28 10:38:52 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-08-28 10:38:52 +0000 |
commit | 073811074bf15742a86572b933b0e3ad0f06107b (patch) | |
tree | 2cc2745c053ceb150fcb7d1a78eff2d470999ac7 /app | |
parent | 891d90a923acf194d7d183873861a5b86d085629 (diff) | |
parent | 1e53f40c25a87a285ce6f35b5ae1717fe87477ae (diff) | |
download | gitlab-ce-073811074bf15742a86572b933b0e3ad0f06107b.tar.gz |
Merge branch 'sh-simplify-system-hook-testing' into 'master'
Simplify system hook testing and guarantee test will fire
Closes #37067
See merge request !13858
Diffstat (limited to 'app')
-rw-r--r-- | app/services/test_hooks/system_service.rb | 37 |
1 files changed, 3 insertions, 34 deletions
diff --git a/app/services/test_hooks/system_service.rb b/app/services/test_hooks/system_service.rb index 76c3c19bd74..67552edefc9 100644 --- a/app/services/test_hooks/system_service.rb +++ b/app/services/test_hooks/system_service.rb @@ -2,47 +2,16 @@ module TestHooks class SystemService < TestHooks::BaseService private - def project - @project ||= begin - project = Project.first - - throw(:validation_error, 'Ensure that at least one project exists.') unless project - - project - end - end - def push_events_data - if project.empty_repo? - throw(:validation_error, "Ensure project \"#{project.human_name}\" has commits.") - end - - Gitlab::DataBuilder::Push.build_sample(project, current_user) + Gitlab::DataBuilder::Push.sample_data end def tag_push_events_data - if project.repository.tags.empty? - throw(:validation_error, "Ensure project \"#{project.human_name}\" has tags.") - end - - Gitlab::DataBuilder::Push.build_sample(project, current_user) + Gitlab::DataBuilder::Push.sample_data end def repository_update_events_data - commit = project.commit - ref = "#{Gitlab::Git::BRANCH_REF_PREFIX}#{project.default_branch}" - - unless commit - throw(:validation_error, "Ensure project \"#{project.human_name}\" has commits.") - end - - change = Gitlab::DataBuilder::Repository.single_change( - commit.parent_id || Gitlab::Git::BLANK_SHA, - commit.id, - ref - ) - - Gitlab::DataBuilder::Repository.update(project, current_user, [change], [ref]) + Gitlab::DataBuilder::Repository.sample_data end end end |