diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-06-04 11:22:14 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-06-04 11:22:14 +0300 |
commit | 554fbb2a49936a8038ee2e26231b69922009023a (patch) | |
tree | b27f26e64b5947364a027e3c87aabd1acb345c22 /spec/services/ci | |
parent | d16c11ab36d91fc51a01406fa77ee2bf307ad8f5 (diff) | |
parent | 6a18a411a30e9e7406ba9335ab502ec396add662 (diff) |
Merge branch 'set-real-next-run-at-for-preventing-duplciate-pipeline-creations' into 'master'
Make pipeline schedule worker resilient
Closes gitlab-com/gl-infra/production#805 and #61955
See merge request gitlab-org/gitlab-ce!28407
Diffstat (limited to 'spec/services/ci')
-rw-r--r-- | spec/services/ci/pipeline_schedule_service_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/services/ci/pipeline_schedule_service_spec.rb b/spec/services/ci/pipeline_schedule_service_spec.rb new file mode 100644 index 00000000000..f2ac53cb25a --- /dev/null +++ b/spec/services/ci/pipeline_schedule_service_spec.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Ci::PipelineScheduleService do + let(:project) { create(:project) } + let(:user) { create(:user) } + let(:service) { described_class.new(project, user) } + + describe '#execute' do + subject { service.execute(schedule) } + + let(:schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } + + it 'schedules next run' do + expect(schedule).to receive(:schedule_next_run!) + + subject + end + + it 'runs RunPipelineScheduleWorker' do + expect(RunPipelineScheduleWorker) + .to receive(:perform_async).with(schedule.id, schedule.owner.id) + + subject + end + end +end |