Skip to content

Commit

Permalink
update provision specs to reflect script lives in parent script
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed May 21, 2024
1 parent 5d05ce5 commit 1b92be7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions spec/models/service_template_provision_task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,26 @@ def service_resource_id(index, scaling_max)
zone = FactoryBot.create(:zone, :name => "special")
automation_manager = FactoryBot.create(:ems_workflows_automation, :zone => zone)
payload = FactoryBot.create(:embedded_workflow, :manager => automation_manager)
@task_0.source = FactoryBot.create(
@task_1.source = FactoryBot.create(
:service_template_generic,
:name => "Provision",
:resource_actions => [
FactoryBot.create(:resource_action, :action => "Provision", :configuration_script_payload => payload)
]
)

@task_0.deliver_queue
@task_1_1.update(
:options => {
# does this go here or in parent?
:configuration_script_payload_id => payload.id,
:parent_task_id => @task_1.id
}
)
@task_1_1.deliver_queue

expect(@task_0.reload.options.keys).to include(:miq_task_id, :configuration_script_id, :configuration_script_payload_id)
expect(@task_1_1.reload.options.keys).to include(:miq_task_id, :configuration_script_id, :configuration_script_payload_id)

configuration_script = ConfigurationScript.find(@task_0.options[:configuration_script_id])
configuration_script = ConfigurationScript.find(@task_1_1.options[:configuration_script_id])

expect(configuration_script).to have_attributes(:manager => automation_manager, :run_by_userid => @admin.userid, :status => "pending")
expect(MiqQueue.first).to have_attributes(
Expand All @@ -142,7 +149,7 @@ def service_resource_id(index, scaling_max)
:method_name => "run",
:queue_name => "automate",
:role => "automate",
:args => [hash_including(:object_type => "ServiceTemplateProvisionTask", :object_id => @task_0.id)]
:args => [hash_including(:object_type => "ServiceTemplateProvisionTask", :object_id => @task_1_1.id)]
)
end
end
Expand Down

0 comments on commit 1b92be7

Please sign in to comment.