Commit 10b09db4 authored by Shinya Maeda's avatar Shinya Maeda

Avoid conflicts between enumlator's schedule! method and state machine's schedule! method

parent 5381985b
...@@ -63,7 +63,7 @@ module Ci ...@@ -63,7 +63,7 @@ module Ci
push: 1, push: 1,
web: 2, web: 2,
trigger: 3, trigger: 3,
schedule: 4, source_schedule: 4,
api: 5, api: 5,
external: 6 external: 6
} }
......
...@@ -12,7 +12,7 @@ class PipelineScheduleWorker ...@@ -12,7 +12,7 @@ class PipelineScheduleWorker
pipeline = Ci::CreatePipelineService.new(schedule.project, pipeline = Ci::CreatePipelineService.new(schedule.project,
schedule.owner, schedule.owner,
ref: schedule.ref) ref: schedule.ref)
.execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) .execute(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
schedule.deactivate! unless pipeline.persisted? schedule.deactivate! unless pipeline.persisted?
rescue => e rescue => e
......
...@@ -21,6 +21,6 @@ class RunPipelineScheduleWorker ...@@ -21,6 +21,6 @@ class RunPipelineScheduleWorker
Ci::CreatePipelineService.new(schedule.project, Ci::CreatePipelineService.new(schedule.project,
user, user,
ref: schedule.ref) ref: schedule.ref)
.execute(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule) .execute(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: schedule)
end end
end end
...@@ -25,7 +25,7 @@ describe PipelineScheduleWorker do ...@@ -25,7 +25,7 @@ describe PipelineScheduleWorker do
shared_examples 'successful scheduling' do shared_examples 'successful scheduling' do
it 'creates a new pipeline' do it 'creates a new pipeline' do
expect { subject }.to change { project.pipelines.count }.by(1) expect { subject }.to change { project.pipelines.count }.by(1)
expect(Ci::Pipeline.last).to be_schedule expect(Ci::Pipeline.last).to be_source_schedule
pipeline_schedule.reload pipeline_schedule.reload
expect(pipeline_schedule.next_run_at).to be > Time.now expect(pipeline_schedule.next_run_at).to be > Time.now
......
...@@ -30,7 +30,7 @@ describe RunPipelineScheduleWorker do ...@@ -30,7 +30,7 @@ describe RunPipelineScheduleWorker do
it 'calls the Service' do it 'calls the Service' do
expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service) expect(Ci::CreatePipelineService).to receive(:new).with(project, user, ref: pipeline_schedule.ref).and_return(create_pipeline_service)
expect(create_pipeline_service).to receive(:execute).with(:schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule) expect(create_pipeline_service).to receive(:execute).with(:source_schedule, ignore_skip_ci: true, save_on_errors: false, schedule: pipeline_schedule)
worker.perform(pipeline_schedule.id, user.id) worker.perform(pipeline_schedule.id, user.id)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment