-
Notifications
You must be signed in to change notification settings - Fork 981
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
Fixes #30552 - Fix vmware vm cloning when volumes are not present #7942
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,6 +218,49 @@ class Foreman::Model::VmwareTest < ActiveSupport::TestCase | |
assert_equal mock_vm, cr.create_vm(attrs_in) | ||
end | ||
|
||
test "#clone_vm works with no volume attributes" do | ||
attrs_in = HashWithIndifferentAccess.new( | ||
"image_id" => "2", | ||
"cpus" => "1", | ||
"interfaces_attributes" => { | ||
"new_interfaces" => { | ||
"type" => "VirtualE1000", | ||
"network" => "network-17", | ||
"_delete" => "", | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style/TrailingCommaInArguments: Avoid comma after the last parameter of a method call. |
||
"0" => { | ||
"type" => "VirtualVmxnet3", | ||
"network" => "network-17", | ||
"_delete" => "", | ||
}, | ||
} | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/ClosingParenthesisIndentation: Indent ) to column 6 (not 4) |
||
attrs_parsed = HashWithIndifferentAccess.new( | ||
"image_id" => "2", | ||
"cpus" => "1", | ||
"interfaces_attributes" => { | ||
"new_interfaces" => { | ||
"type" => "VirtualE1000", | ||
"network" => "Test network", | ||
"_delete" => "", | ||
}, | ||
"0" => { | ||
"type" => "VirtualVmxnet3", | ||
"network" => "Test network", | ||
"_delete" => "", | ||
}, | ||
}, | ||
"provision_method" => "image" | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Layout/ClosingParenthesisIndentation: Indent ) to column 6 (not 4) |
||
|
||
mock_vm = mock('vm') | ||
cr = FactoryBot.build_stubbed(:vmware_cr) | ||
cr.expects(:parse_networks).with(attrs_in).returns(attrs_parsed) | ||
cr.expects(:clone_vm).with(attrs_parsed).returns(mock_vm) | ||
cr.expects(:test_connection) | ||
assert_equal mock_vm, cr.create_vm(attrs_in) | ||
end | ||
|
||
describe "#parse_args" do | ||
setup do | ||
@cr = FactoryBot.build_stubbed(:vmware_cr) | ||
|
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.
This doesn't look like it's specific to hammer, would a clearer commit message be something like "fix vmware vm cloning when volumes are not present"?
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, I agree I will change the commit message.