[Ovirt-devel] [PATCH server] Fixed the tests for host-browser.

Mohammed Morsi mmorsi at redhat.com
Thu Oct 2 18:56:36 UTC 2008


Darryl L. Pierce wrote:
> A change to the identify protocol was overlooked. When an empty value was
> submitted, host-browser would throw an exception. But, a change allowed
> empty values to get by without notice. Fixed.
>
> Also added a Requires dependency on ruby-flexmock so that the RPM is
> correctly installed when building the server RPM.
>
> Finally, reintroduced a line that was deleted by mistaken from NicControllerTest.
>
> Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
> ---
>  ovirt-server.spec.in                        |    1 +
>  src/host-browser/host-browser.rb            |    9 +++++++--
>  src/test/functional/nic_controller_test.rb  |    2 ++
>  src/test/unit/host_browser_awaken_test.rb   |    3 +++
>  src/test/unit/host_browser_identify_test.rb |    3 +++
>  5 files changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in
> index 114b52d..1339b52 100644
> --- a/ovirt-server.spec.in
> +++ b/ovirt-server.spec.in
> @@ -19,6 +19,7 @@ Requires: rubygem(mongrel) >= 1.0.1
>  Requires: rubygem(krb5-auth) >= 0.6
>  Requires: rubygem(cobbler) >= 0.0.2
>  Requires: rubygem(gettext)
> +Requires: ruby-flexmock
>  Requires: postgresql-server
>  Requires: ruby-postgres
>  Requires: xapian-bindings-ruby
> diff --git a/src/host-browser/host-browser.rb b/src/host-browser/host-browser.rb
> index 3adea03..2241614 100755
> --- a/src/host-browser/host-browser.rb
> +++ b/src/host-browser/host-browser.rb
> @@ -46,10 +46,15 @@ class HostBrowser
>      def initialize(session)
>          @session = session
>          @keytab_dir = '/usr/share/ipa/html/'
> +        set_peeraddr @session.peeraddr[3]
> +    end
> +
> +    def set_peeraddr(peeraddr)
> +      @peeraddr = peeraddr
>      end
>  
>      def prefix(session)
> -      "#{Time.now.strftime('%b %d %H:%M:%S')} #{session.peeraddr[3]} "
> +      "#{Time.now.strftime('%b %d %H:%M:%S')} #{@peeraddr} "
>      end
>  
>      # Ensures the conversation starts properly.
> @@ -113,7 +118,7 @@ class HostBrowser
>                  nic_info << nic
>              else
>  
> -                raise Exception.new("ERRINFO! Expected key=value : #{info}\n") unless info =~ /[\w]+[\s]*=[\w]*/
> +                raise Exception.new("ERRINFO! Expected key=value : #{info}\n") unless info =~ /[\w]+[\s]*=[\w]+/
>  
>                  key, value = info.split("=")
>  
> diff --git a/src/test/functional/nic_controller_test.rb b/src/test/functional/nic_controller_test.rb
> index 74a80f4..1fa34ff 100644
> --- a/src/test/functional/nic_controller_test.rb
> +++ b/src/test/functional/nic_controller_test.rb
> @@ -30,6 +30,8 @@ class NicControllerTest < Test::Unit::TestCase
>      @controller = NicController.new
>      @request    = ActionController::TestRequest.new
>      @response   = ActionController::TestResponse.new
> +    
> +    @first_id = nics(:one).id
>    end
>  
>    def test_show
> diff --git a/src/test/unit/host_browser_awaken_test.rb b/src/test/unit/host_browser_awaken_test.rb
> index 5340e01..53711ee 100644
> --- a/src/test/unit/host_browser_awaken_test.rb
> +++ b/src/test/unit/host_browser_awaken_test.rb
> @@ -18,6 +18,9 @@
>  # MA  02110-1301, USA.  A copy of the GNU General Public License is
>  # also available at http://www.gnu.org/copyleft/gpl.html.
>  
> +$: << File.join(File.dirname(__FILE__), "../../dutils")
> +$: << File.join(File.dirname(__FILE__), "../../host-browser")
> + 
>  require File.dirname(__FILE__) + '/../test_helper'
>  require 'test/unit'
>  require 'flexmock/test_unit'
> diff --git a/src/test/unit/host_browser_identify_test.rb b/src/test/unit/host_browser_identify_test.rb
> index 87c6f0b..86f5a73 100644
> --- a/src/test/unit/host_browser_identify_test.rb
> +++ b/src/test/unit/host_browser_identify_test.rb
> @@ -18,6 +18,9 @@
>  # MA  02110-1301, USA.  A copy of the GNU General Public License is
>  # also available at http://www.gnu.org/copyleft/gpl.html.
>  
> +$: << File.join(File.dirname(__FILE__), "../../dutils")
> +$: << File.join(File.dirname(__FILE__), "../../host-browser")
> + 
>  require File.dirname(__FILE__) + '/../test_helper'
>  
>  require 'test/unit'
>   
ACK, with a few caveats.

Applying this patch once again complains about whitespace issues. It
didn't affect my testing it as it applied fine, and figure you'll catch
this as if you try to push with extraneous whitespace our repo won't let
you.

This takes care of all the outstanding errors I noticed up to this
point. Unfortunately it seems that since these nic / browser issues are
fixed, other errors are now apparent, particularly that pertaining to
bonding. I attached the output of my 'rake test' run, so as to help in
debugging. It seems the most prominent issue is 'type_id' which is
attempted to be set in the bonding_test "setup" method, but which
doesn't exist in the bondings database table. The last three errors
(6,7,8) seem to indicate another problem which I'm not sure the cause of.

   -Mo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: rake-test-output
URL: <http://listman.redhat.com/archives/ovirt-devel/attachments/20081002/be8008ea/attachment.ksh>


More information about the ovirt-devel mailing list