summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-12-23 14:51:20 +0000
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-12-23 13:50:56 -0200
commit1af7a910ea52305ad83254d2245ec16899b7a923 (patch)
tree63d719c9b0b31ca43bf49a0d41769b94fab9eefc /spec
parent811262eb933a0c80fcbfb6818d2fc81e264c75f0 (diff)
downloadgitlab-ce-1af7a910ea52305ad83254d2245ec16899b7a923.tar.gz
Merge branch 'process-commit-worker-large-batches' into 'master'
Improve ProcessCommitWorker for large push payloads Closes #25827 See merge request !8267
Diffstat (limited to 'spec')
-rw-r--r--spec/services/git_push_service_spec.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index e7624e70725..3303e808a9c 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -604,6 +604,25 @@ describe GitPushService, services: true do
end
end
+ describe '#process_commit_messages' do
+ let(:service) do
+ described_class.new(project,
+ user,
+ oldrev: sample_commit.parent_id,
+ newrev: sample_commit.id,
+ ref: 'refs/heads/master')
+ end
+
+ it 'only schedules a limited number of commits' do
+ allow(service).to receive(:push_commits).
+ and_return(Array.new(1000, double(:commit, to_hash: {})))
+
+ expect(ProcessCommitWorker).to receive(:perform_async).exactly(100).times
+
+ service.process_commit_messages
+ end
+ end
+
def execute_service(project, user, oldrev, newrev, ref)
service = described_class.new(project, user, oldrev: oldrev, newrev: newrev, ref: ref )
service.execute