diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/services/git | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/services/git')
-rw-r--r-- | spec/services/git/base_hooks_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/git/branch_hooks_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/git/branch_push_service_spec.rb | 33 | ||||
-rw-r--r-- | spec/services/git/process_ref_changes_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/git/tag_hooks_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/git/tag_push_service_spec.rb | 39 | ||||
-rw-r--r-- | spec/services/git/wiki_push_service/change_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/git/wiki_push_service_spec.rb | 10 |
8 files changed, 74 insertions, 18 deletions
diff --git a/spec/services/git/base_hooks_service_spec.rb b/spec/services/git/base_hooks_service_spec.rb index 07ce560bd88..661c77b56bb 100644 --- a/spec/services/git/base_hooks_service_spec.rb +++ b/spec/services/git/base_hooks_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::BaseHooksService do +RSpec.describe Git::BaseHooksService do include RepoHelpers include GitHelpers diff --git a/spec/services/git/branch_hooks_service_spec.rb b/spec/services/git/branch_hooks_service_spec.rb index 908b9772c40..7f22af8bfc6 100644 --- a/spec/services/git/branch_hooks_service_spec.rb +++ b/spec/services/git/branch_hooks_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::BranchHooksService do +RSpec.describe Git::BranchHooksService do include RepoHelpers include ProjectForksHelper diff --git a/spec/services/git/branch_push_service_spec.rb b/spec/services/git/branch_push_service_spec.rb index 6ecc1a62ff3..6ccf2d03e4a 100644 --- a/spec/services/git/branch_push_service_spec.rb +++ b/spec/services/git/branch_push_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::BranchPushService, services: true do +RSpec.describe Git::BranchPushService, services: true do include RepoHelpers let_it_be(:user) { create(:user) } @@ -635,6 +635,37 @@ describe Git::BranchPushService, services: true do end end + describe 'artifacts' do + context 'create branch' do + let(:oldrev) { blankrev } + + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + + context 'update branch' do + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + + context 'delete branch' do + let(:newrev) { blankrev } + + it 'unlocks artifacts' do + expect(::Ci::RefDeleteUnlockArtifactsWorker) + .to receive(:perform_async).with(project.id, user.id, "refs/heads/#{branch}") + + execute_service(project, user, oldrev: oldrev, newrev: newrev, ref: ref) + end + end + end + describe 'Hooks' do context 'run on a branch' do it 'delegates to Git::BranchHooksService' do diff --git a/spec/services/git/process_ref_changes_service_spec.rb b/spec/services/git/process_ref_changes_service_spec.rb index 924e913a9ec..c2fb40a0ed0 100644 --- a/spec/services/git/process_ref_changes_service_spec.rb +++ b/spec/services/git/process_ref_changes_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::ProcessRefChangesService do +RSpec.describe Git::ProcessRefChangesService do let(:project) { create(:project, :repository) } let(:user) { project.owner } let(:params) { { changes: git_changes } } diff --git a/spec/services/git/tag_hooks_service_spec.rb b/spec/services/git/tag_hooks_service_spec.rb index 094ccd8c9f0..4443c46a414 100644 --- a/spec/services/git/tag_hooks_service_spec.rb +++ b/spec/services/git/tag_hooks_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::TagHooksService, :service do +RSpec.describe Git::TagHooksService, :service do let(:user) { create(:user) } let(:project) { create(:project, :repository) } diff --git a/spec/services/git/tag_push_service_spec.rb b/spec/services/git/tag_push_service_spec.rb index 9688041c08c..87dbf79a245 100644 --- a/spec/services/git/tag_push_service_spec.rb +++ b/spec/services/git/tag_push_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::TagPushService do +RSpec.describe Git::TagPushService do include RepoHelpers include GitHelpers @@ -10,9 +10,11 @@ describe Git::TagPushService do let(:project) { create(:project, :repository) } let(:service) { described_class.new(project, user, change: { oldrev: oldrev, newrev: newrev, ref: ref }) } - let(:oldrev) { Gitlab::Git::BLANK_SHA } + let(:blankrev) { Gitlab::Git::BLANK_SHA } + let(:oldrev) { blankrev } let(:newrev) { "8a2a6eb295bb170b34c24c76c49ed0e9b2eaf34b" } # gitlab-test: git rev-parse refs/tags/v1.1.0 - let(:ref) { 'refs/tags/v1.1.0' } + let(:tag) { 'v1.1.0' } + let(:ref) { "refs/tags/#{tag}" } describe "Push tags" do subject do @@ -58,4 +60,35 @@ describe Git::TagPushService do end end end + + describe 'artifacts' do + context 'create tag' do + let(:oldrev) { blankrev } + + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + service.execute + end + end + + context 'update tag' do + it 'does nothing' do + expect(::Ci::RefDeleteUnlockArtifactsWorker).not_to receive(:perform_async) + + service.execute + end + end + + context 'delete tag' do + let(:newrev) { blankrev } + + it 'unlocks artifacts' do + expect(::Ci::RefDeleteUnlockArtifactsWorker) + .to receive(:perform_async).with(project.id, user.id, "refs/tags/#{tag}") + + service.execute + end + end + end end diff --git a/spec/services/git/wiki_push_service/change_spec.rb b/spec/services/git/wiki_push_service/change_spec.rb index 4da3f0fc738..3616bf62b20 100644 --- a/spec/services/git/wiki_push_service/change_spec.rb +++ b/spec/services/git/wiki_push_service/change_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::WikiPushService::Change do +RSpec.describe Git::WikiPushService::Change do subject { described_class.new(project_wiki, change, raw_change) } let(:project_wiki) { double('ProjectWiki') } diff --git a/spec/services/git/wiki_push_service_spec.rb b/spec/services/git/wiki_push_service_spec.rb index b2234c81c24..f338b7a5709 100644 --- a/spec/services/git/wiki_push_service_spec.rb +++ b/spec/services/git/wiki_push_service_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -describe Git::WikiPushService, services: true do +RSpec.describe Git::WikiPushService, services: true do include RepoHelpers let_it_be(:key_id) { create(:key, user: current_user).shell_id } @@ -247,14 +247,6 @@ describe Git::WikiPushService, services: true do end end - context 'the wiki_events feature is disabled' do - before do - stub_feature_flags(wiki_events: false) - end - - it_behaves_like 'a no-op push' - end - context 'the wiki_events_on_git_push feature is disabled' do before do stub_feature_flags(wiki_events_on_git_push: false) |