[Ovirt-devel] Re: [PATCH server] fixes to the bonding tests

Mohammed Morsi mmorsi at redhat.com
Thu Oct 9 20:49:29 UTC 2008


Mohammed Morsi wrote:
> ---
>  src/app/models/bonding.rb      |    2 ++
>  src/app/models/bonding_type.rb |    2 ++
>  src/test/unit/bonding_test.rb  |    9 ---------
>  3 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/src/app/models/bonding.rb b/src/app/models/bonding.rb
> index 941e2cd..eb25d05 100644
> --- a/src/app/models/bonding.rb
> +++ b/src/app/models/bonding.rb
> @@ -36,6 +36,8 @@ class Bonding < ActiveRecord::Base
>    validates_presence_of :interface_name,
>      :message => 'An interface name is required.'
>  
> +  validates_presence_of :host_id
> +
>    belongs_to :host
>    belongs_to :bonding_type
>  
> diff --git a/src/app/models/bonding_type.rb b/src/app/models/bonding_type.rb
> index e0d2193..7697ff4 100644
> --- a/src/app/models/bonding_type.rb
> +++ b/src/app/models/bonding_type.rb
> @@ -23,4 +23,6 @@
>  class BondingType < ActiveRecord::Base
>    validates_presence_of :label
>    validates_presence_of :mode
> +
> +  validates_uniqueness_of :mode
>  end
> diff --git a/src/test/unit/bonding_test.rb b/src/test/unit/bonding_test.rb
> index 4bdb079..1dbab38 100644
> --- a/src/test/unit/bonding_test.rb
> +++ b/src/test/unit/bonding_test.rb
> @@ -30,7 +30,6 @@ class BondingTest < ActiveSupport::TestCase
>      @bonding = Bonding.new(
>        :name           => 'Bonding1',
>        :interface_name => 'bond0',
> -      :type_id        => bonding_types(:failover_bonding_type),
>        :host_id        => hosts(:mailservers_managed_node))
>    end
>  
> @@ -50,14 +49,6 @@ class BondingTest < ActiveSupport::TestCase
>      flunk 'Bondings have to have an interface name.' if @bonding.valid?
>    end
>  
> -  # Ensures that the bonding type is required.
> -  #
> -  def test_valid_fails_without_type
> -    @bonding.type_id = nil
> -
> -    flunk 'Bondings have to have a valid type.' if @bonding.valid?
> -  end
> -
>    # Ensures that a host is required
>    #
>    def test_valid_fails_without_host
>   

There are still two tests broken. I traced the problem to
host-browser/host-browser.rb line 305 where calls to
BondingType.find_by_proto fail to return anything. Checking the database
at this time verifies that there is nothing in the table, which is
strange as this is only an issue for those two test cases, all other
times it works successfully (BondingType table gets populated and
everything). I have a feeling some deletion is cascading to deleting the
BondingType entries, or a similar issue but I'm not sure where this is
happening. Think you could take care of these last two bits as you know
this bonding / nic system better than I do (also if something looks
wrong in this patch, could you correct it?)

  Thanks alot,
    Mo


  1) Failure:
test_write_host_info_with_duplicate_nic(HostBrowserIdentifyTest)
    [./test/unit/host_browser_identify_test.rb:226:in
`test_write_host_info_with_duplicate_nic'
    
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`__send__'
    
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`run']:
Exception raised:
Class: <RuntimeError>
Message: <"Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id">
---Backtrace---
./test/unit/../../host-browser/host-browser.rb:317:in `write_host_info'
./test/unit/../../host-browser/host-browser.rb:308:in `collect'
./test/unit/../../host-browser/host-browser.rb:308:in `write_host_info'
./test/unit/host_browser_identify_test.rb:226:in
`test_write_host_info_with_duplicate_nic'
./test/unit/host_browser_identify_test.rb:226:in
`test_write_host_info_with_duplicate_nic'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`run'
---------------

  2) Failure:
test_write_host_info_with_missing_uuid(HostBrowserIdentifyTest)
    [./test/unit/host_browser_identify_test.rb:167:in
`test_write_host_info_with_missing_uuid'
    
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`__send__'
    
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`run']:
Exception raised:
Class: <RuntimeError>
Message: <"Called id for nil, which would mistakenly be 4 -- if you
really wanted the id of nil, use object_id">
---Backtrace---
./test/unit/../../host-browser/host-browser.rb:317:in `write_host_info'
./test/unit/../../host-browser/host-browser.rb:308:in `collect'
./test/unit/../../host-browser/host-browser.rb:308:in `write_host_info'
./test/unit/host_browser_identify_test.rb:167:in
`test_write_host_info_with_missing_uuid'
./test/unit/host_browser_identify_test.rb:167:in
`test_write_host_info_with_missing_uuid'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`__send__'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/testing/setup_and_teardown.rb:33:in
`run'
---------------




More information about the ovirt-devel mailing list