[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 BuildRequires dependency on ruby-flexmock so that the RPM is
correctly installed when building the server RPM.

Signed-off-by: Darryl L. Pierce <dpierce redhat com>
---
 ovirt-server.spec.in                      |    1 +
 src/host-browser/host-browser.rb          |    9 +++++++--
 src/test/unit/host_browser_awaken_test.rb |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ovirt-server.spec.in b/ovirt-server.spec.in
index a65e628..f351e77 100644
--- a/ovirt-server.spec.in
+++ b/ovirt-server.spec.in
@@ -35,6 +35,7 @@ Requires(preun): /sbin/chkconfig
 Requires(preun): /sbin/service
 BuildRequires: ruby >= 1.8.1
 BuildRequires: ruby-devel
+BuildRequires: ruby-flexmock
 BuildRequires: ruby-gettext-package
 BuildRequires: rubygem(rake) >= 0.7
 Provides: ovirt-server
diff --git a/src/host-browser/host-browser.rb b/src/host-browser/host-browser.rb
index 3adea03..a33e657 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/unit/host_browser_awaken_test.rb b/src/test/unit/host_browser_awaken_test.rb
index 5340e01..55a3458 100644
--- a/src/test/unit/host_browser_awaken_test.rb
+++ b/src/test/unit/host_browser_awaken_test.rb
@@ -64,7 +64,7 @@ class HostBrowserAwakenTest < Test::Unit::TestCase
   # Ensures that the server is satisfied if the remote system is
   # making a wakeup call.
   #
-  def test_get_mode_with_awaken_request
+  def test_get_mode_with_awaken_request    
     @session.should_receive(:write).with("MODE?\n").once().returns { |request| request.length }
     @session.should_receive(:readline).once().returns { "AWAKEN\n" }
 
-- 
1.5.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]