Revision 47990639
Added by Tomáš Strachota over 8 years ago
test/unit/interface_merge_test.rb | ||
---|---|---|
interfaces = [
|
||
FactoryGirl.build(:nic_managed, :identifier => 'eth0')
|
||
]
|
||
@merge.run(interfaces, nil)
|
||
@merge.run(stub(:interfaces => interfaces), nil)
|
||
|
||
assert_equal 1, interfaces.length
|
||
assert_equal EMPTY_ATTRS, interfaces[0].compute_attributes
|
||
... | ... | |
FactoryGirl.build(:nic_managed, :identifier => 'eth1'),
|
||
FactoryGirl.build(:nic_managed, :identifier => 'eth2')
|
||
]
|
||
@merge.run(interfaces, @attributes)
|
||
@merge.run(stub(:interfaces => interfaces), @attributes)
|
||
|
||
assert_equal 3, interfaces.length
|
||
assert_equal expected_attrs(1), interfaces[0].compute_attributes
|
||
... | ... | |
interfaces = [
|
||
FactoryGirl.build(:nic_managed, :identifier => 'eth0', :compute_attributes => {'attr' => 9}),
|
||
]
|
||
@merge.run(interfaces, @attributes)
|
||
@merge.run(stub(:interfaces => interfaces), @attributes)
|
||
|
||
assert_equal expected_attrs(9), interfaces[0].compute_attributes
|
||
assert_equal 'eth0', interfaces[0].identifier
|
||
... | ... | |
|
||
test "it creates NICs when there aren't any" do
|
||
interfaces = []
|
||
@merge.run(interfaces, @attributes)
|
||
@merge.run(stub(:interfaces => interfaces), @attributes)
|
||
|
||
assert_equal 2, interfaces.length
|
||
assert_equal expected_attrs(1), interfaces[0].compute_attributes
|
||
... | ... | |
interfaces = [
|
||
FactoryGirl.build(:nic_managed, :identifier => 'eth0')
|
||
]
|
||
@merge.run(interfaces, @attributes)
|
||
@merge.run(stub(:interfaces => interfaces), @attributes)
|
||
|
||
assert_equal 2, interfaces.length
|
||
assert_equal expected_attrs(1), interfaces[0].compute_attributes
|
Also available in: Unified diff
Fixes #6342 - merge compute profile when attributes in api host#create
API v2 host#craete call now merges user specified compute attributes
with compute profile. UI functionality remains untouched.