cc_worker should honor skip_job_progress

fixes CNVS-6789

test plan:
- run an academic benchmark import
- the job should succeed

Change-Id: Ia716a781ca03d6a70db748a08bec6397850f9a94
Reviewed-on: https://gerrit.instructure.com/22167
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
Simon Williams 2013-07-09 16:37:21 -06:00
parent 8dbbb0a622
commit 00f1f574d5
2 changed files with 11 additions and 2 deletions

View File

@ -18,7 +18,7 @@
class Canvas::Migration::Worker::CCWorker < Struct.new(:migration_id)
def perform
cm = ContentMigration.find_by_id migration_id
cm.job_progress.start
cm.job_progress.start unless cm.skip_job_progress
begin
cm.update_conversion_progress(1)
settings = cm.migration_settings.clone
@ -64,7 +64,7 @@ class Canvas::Migration::Worker::CCWorker < Struct.new(:migration_id)
rescue Canvas::Migration::Error
cm.add_error($!.message, :exception => $!)
cm.workflow_state = :failed
cm.job_progress.fail
cm.job_progress.fail unless cm.skip_job_progress
cm.save
rescue => e
cm.fail_with_error!(e) if cm

View File

@ -28,4 +28,13 @@ describe Canvas::Migration::Worker::CCWorker do
worker.perform().should == true
cm.reload.migration_settings[:worker_class].should == 'CC::Importer::Canvas::Converter'
end
it "should honor skip_job_progress" do
cm = ContentMigration.create!(:migration_settings => { :no_archive_file => true, :skip_job_progress => true })
Canvas::Migration::Worker.expects(:get_converter).with(anything).returns(CC::Importer::Canvas::Converter)
CC::Importer::Canvas::Converter.any_instance.expects(:export).returns({})
worker = Canvas::Migration::Worker::CCWorker.new(cm.id)
worker.perform().should == true
cm.skip_job_progress.should be_true
end
end