Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an embedded_terraform_job FactoryBot factory #80

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/factories/job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FactoryBot.define do
factory :embedded_terraform_job,
:parent => :job,
:class => "ManageIQ::Providers::EmbeddedTerraform::AutomationManager::Job" do
options { {} }
state { "waiting_to_start" }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@
end
let(:miq_task) { FactoryBot.create(:miq_task, :job => job) }

let(:job) do
ManageIQ::Providers::EmbeddedTerraform::AutomationManager::Job.create_job(template, {}, {}, []).tap do |job|
job.state = "finished"
job.options = {
:terraform_stack_id => hello_world_retrieve_response['stack_id']
}
end
end

let(:job) { FactoryBot.create(:embedded_terraform_job, :state => "finished", :options => {:terraform_stack_id => hello_world_retrieve_response['stack_id']})}
let(:terraform_runner_stdout) { hello_world_retrieve_response['message'] }
let(:terraform_runner_stdout_html) { TerminalToHtml.render(terraform_runner_stdout) }

Expand Down Expand Up @@ -118,13 +110,7 @@
end

context "when miq_task.job.options present but missing terraform_stack_id" do
let(:job) do
ManageIQ::Providers::EmbeddedTerraform::AutomationManager::Job.create_job(template, {}, {}, []).tap do |job|
job.state = "waiting_to_start"
job.options = {}
end
end

let(:job) { FactoryBot.create(:embedded_terraform_job) }
let(:miq_task) { FactoryBot.create(:miq_task, :job => job) }

it_behaves_like "terraform runner stdout not available from miq_task"
Expand Down