Project

General

Profile

« Previous | Next » 

Revision ee1f56de

Added by Marek Hulán over 9 years ago

Fixes #9044 - fixes invalid mac in tests

Also do not reset invalid mac address to nil so we can propagate proper
validation error.

View differences:

test/unit/orchestration/dhcp_test.rb
test "when an existing host change its mac address, its dhcp record should be updated" do
h = FactoryGirl.create(:host, :with_dhcp_orchestration)
h.mac = h.mac.succ
h.mac = next_mac(h.mac)
assert h.valid?
assert_equal 2, h.queue.items.select {|x| x.action == [ h, :set_dhcp ] }.size
assert_equal 1, h.queue.items.select {|x| x.action == [ h.old, :del_dhcp ] }.size
......
end
h.reload
bmc = h.interfaces.bmc.first
bmc.mac = bmc.mac.succ
bmc.mac = next_mac(bmc.mac)
assert h.valid?
assert bmc.valid?
assert_equal 1, bmc.queue.items.select {|x| x.action == [ bmc, :set_dhcp ] }.size
......
:name => "bmc-it", :provider => 'IPMI', :ip => h.ip.succ)
end
h.reload
h.mac = h.mac.succ
h.mac = next_mac(h.mac)
bmc = h.interfaces.bmc.first
assert !bmc.new_record?
bmc.mac = bmc.mac.succ
bmc.mac = next_mac(bmc.mac)
assert h.valid?
assert bmc.valid?
assert_equal 2, h.queue.items.select {|x| x.action == [ h, :set_dhcp ] }.size

Also available in: Unified diff