-
Notifications
You must be signed in to change notification settings - Fork 11
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 methods to fetch terraform stdout for showing in UI. #78
Add methods to fetch terraform stdout for showing in UI. #78
Conversation
app/models/manageiq/providers/embedded_terraform/automation_manager/stack.rb
Outdated
Show resolved
Hide resolved
app/models/manageiq/providers/embedded_terraform/automation_manager/stack.rb
Outdated
Show resolved
Hide resolved
app/models/manageiq/providers/embedded_terraform/automation_manager/stack.rb
Outdated
Show resolved
Hide resolved
@putmanoj Can you add some specs for these methods? You can probably copy a lot from core's spec/models/manageiq/providers/embedded_ansible/automation_manager/job_spec.rb around line 143+ |
…terraform_stack_id in job
app/models/manageiq/providers/embedded_terraform/automation_manager/stack.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
spec/models/manageiq/providers/embedded_terraform/automation_manager/stack_spec.rb
Outdated
Show resolved
Hide resolved
…unner_stack_data is not available
specs added |
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'] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a FactoryBot factory would be a better way to set up these Job objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let(:terraform_runner_url) { "https://1.2.3.4:7000" } | ||
let(:hello_world_retrieve_response) do | ||
require 'json' | ||
JSON.parse(File.read(File.join(__dir__, "../../../../../lib/terraform/runner/data/responses/hello-world-retrieve-success.json"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to consider moving this up to spec/data
or something if it is going to be used by more than just the Terraform::Runner
specs since this ../../../etc...
makes it hard to read where this file lives. Without counting the parent dirs I thought this lived in the "production" lib/terraform directory not spec/lib/terraform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes agree makes it harder to read,
could make it like
"../../../../../../spec/lib/terraform/runner/data/responses/hello-world-retrieve-success.json"
also maybe should move this common test data, to somewhere like <base-dir>/spec/data
. then still look like
"../../../../../../spec/data/responses/hello-world-retrieve-success.json"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't know if there more easier way to refer to test data resources without using "../../../../../../"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use the ManageIQ::Providers::EmbeddedTerraform::Engine.root
Pathname to build a path from the root of the plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A number of items that we can clean up but overall looks good to me
Backported to
|
…t-for-ui Add methods to fetch terraform stdout for showing in UI. (cherry picked from commit 4c66529)
Related:
Add methods in Stack, to fetch terraform job stdout from TerraformRunner
api/stack