preserve report's created_at and updated_at fields

This commit is contained in:
Anton Chuchkalov 2016-02-16 16:27:54 +03:00
parent 7e6c5c2f72
commit 3c0c850c58
2 changed files with 3 additions and 1 deletions

View File

@ -15,6 +15,7 @@ RSpec.describe StackBootstrapWorker, type: :worker, stubbed_connector: true do
before do
allow(Provider::ProviderFactory).to receive(:providers).and_return(%w(ec2))
allow(stubbed_connector).to receive(:save_report)
allow(stubbed_connector).to receive(:report) { build(:report) }
allow(stubbed_connector).to receive(:report_update)
allow(stubbed_connector).to receive(:stack_insert)

View File

@ -132,7 +132,8 @@ class Worker
end
def update_report(additional_report_attrs)
report_attrs = additional_report_attrs.merge('_id' => jid, 'file' => @file)
initial_report = mongo.report(jid)
report_attrs = initial_report.to_mongo_hash.merge(additional_report_attrs)
report = Devops::Model::Report.new(report_attrs)
mongo.report_update(report)
report