Revision 66a5487c
Added by Marek Hulán almost 9 years ago
test/unit/host_test.rb | ||
---|---|---|
assert_equal 'eth5', virtual.attached_to
|
||
end
|
||
|
||
test "#set_interfaces does not update unassociated virtuals identifier on identifier change if original identifier was blank" do
|
||
# interface with empty identifier was renamed to eth5 (same MAC)
|
||
host = FactoryGirl.create(:host, :hostgroup => FactoryGirl.create(:hostgroup), :mac => '00:00:00:11:22:33')
|
||
host.primary_interface.update_attribute :identifier, ''
|
||
hash = { :bond0 => {:macaddress => '00:00:00:44:55:66', :ipaddress => '10.10.0.2', :virtual => true},
|
||
:eth5 => {:macaddress => '00:00:00:11:22:33', :ipaddress => '10.10.0.1', :virtual => false, :identifier => 'eth5'},
|
||
}.with_indifferent_access
|
||
parser = stub(:interfaces => hash, :ipmi_interface => {}, :suggested_primary_interface => hash.to_a.first)
|
||
bond0 = FactoryGirl.create(:nic_bond, :host => host, :mac => '00:00:00:44:55:66', :ip => '10.10.0.2', :identifier => 'bond0', :attached_to => '')
|
||
|
||
host.set_interfaces(parser)
|
||
bond0.reload
|
||
assert_equal 'bond0', bond0.identifier
|
||
assert_equal '', bond0.attached_to
|
||
end
|
||
|
||
test "set_interfaces updates associated virtuals identifier even on primary interface" do
|
||
host, parser = setup_host_with_nic_parser({:macaddress => '00:00:00:11:22:33', :ipaddress => '10.10.0.1', :virtual => false, :identifier => 'eth1'})
|
||
host.primary_interface.update_attribute :identifier, 'eth0'
|
Also available in: Unified diff
Fixes #10888 - skip attached_to updates if identifier was blank
(cherry picked from commit db6d6b8b7d0d2e90e27d4c23308e5db26abd3820)