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

Re: [Ovirt-devel] oVirt / Selenium Update



Mohammed Morsi wrote:
Attached is a patch and other relevant files containing my recent work in integrating the Selenium test suite into oVirt.

Attached is the updated patch including the selenium.rb file existance check. Also attached is the selenium server init script with a few additional tweaks. Both this script and autobuild now require a few selenium related components on the host system, under /root/ovirt (changed to whatever) namely the actual selenium server jar, the ruby selenium.rb module, and the template firefox profile as mentioned in the last email. If the selenium ruby module isn't available, autobuild will make note of it and continue, but it will never be uploaded to the wui appliance and thus the interface tests will never be run. One last thing, that I failed to mention in my last email, is that due to the headless test server issues as discussed in the previous selenium email thread, and the vncserver solution, the selenium init script instructs all graphical operations to take place on DISPLAY :5, which must be running.

  -Mo
#!/bin/bash
#
#
#  selenium   startup script for selenium
#
#  make sure in the specified firefox profile, the prefs.js file contains:
#    user_pref("network.http.phishy-userpass-length", 255);
#    user_pref("browser.sessionstore.enabled", false);
#
# chkconfig: - 97 03
# description: Selenium Remote Control server use to launch Selenium tests

#[ -r /etc/sysconfig/selenium ] && . /etc/sysconfig/selenium

JAVA_PROG=java
SELENIUM_JAR=/root/ovirt/selenium/selenium-server-1.0/selenium-server.jar
FIREFOX_PROFILE_DIR=/root/ovirt/selenium-firefox-profile/

PID_FILE=/var/run/selenium.pid

RETVAL=0

. /etc/init.d/functions

start() {
   echo -n "Starting Selenium"
   export DISPLAY=:5
   $JAVA_PROG -jar $SELENIUM_JAR -firefoxProfileTemplate $FIREFOX_PROFILE_DIR&
   RETVAL=$?
   echo $! > $PID_FILE
   if [ $RETVAL -eq 0 ]; then
       echo_success
       echo
   else
       echo_failure
       echo
   fi
}

stop() {
  echo -n "Stopping Selenium"
  PID=`cat $PID_FILE`
  kill $PID
  rm -f $PID_FILE
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart)
        stop
        start
       ;;
    *)
      echo "Usage: selenium {start|stop|restart}"
      exit 1
  ;;
esac

exit $RETVAL
>From c90468d71e52964aa0f75100968253a8b1acd33a Mon Sep 17 00:00:00 2001
From: Mohammed Morsi <mmorsi redhat com>
Date: Tue, 12 Aug 2008 20:27:45 -0400
Subject: [PATCH] selenium integration into the ovirt wui test suite

---
 autobuild.sh                              |   15 +++++++++-
 wui/conf/ovirt-wui.conf                   |    5 ---
 wui/src/test/functional/interface_test.rb |   42 +++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 6 deletions(-)
 create mode 100644 wui/src/test/functional/interface_test.rb

diff --git a/autobuild.sh b/autobuild.sh
index b87d205..fc81865 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -26,8 +26,10 @@ die() { warn "$@"; exit 1; }
 echo "Running oVirt Autobuild"
 
 SSHKEY=~/.ssh/id_autobuild
+remote_target="root 192 168 50 2"
 ssh_cmd="ssh -i $SSHKEY -o StrictHostKeyChecking=no \
-             -o UserKnownHostsFile=/dev/null root 192 168 50 2"
+             -o UserKnownHostsFile=/dev/null $remote_target"
+scp_cmd="scp -i $SSHKEY -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
 
 # implant Autobuild SSH key into appliance
 if [ ! -r $SSHKEY ]; then
@@ -65,6 +67,17 @@ for i in $(seq 1 60); do
    sleep 10
 done
 
+if [ -f /root/ovirt/selenium.rb ]; then
+  $scp_cmd /root/ovirt/selenium.rb $remote_target:/usr/share/ovirt-wui/test/
+else
+  echo "selenium.rb not found, will not run interface tests"
+fi
+
+$ssh_cmd \
+  "sed -i -e \"s/KrbMethodNegotiate on/KrbMethodNegotiate off/g\" \
+          -e \"s/KrbMethodK5Passwd off/KrbMethodK5Passwd on/g\" \
+          /etc/httpd/conf.d/ovirt-wui.conf"
+
 echo "Running the wui tests"
 $ssh_cmd \
     "curl -i --negotiate -u : management.priv.ovirt.org/ovirt/ | \
diff --git a/wui/conf/ovirt-wui.conf b/wui/conf/ovirt-wui.conf
index 022e6e4..f56ce81 100644
--- a/wui/conf/ovirt-wui.conf
+++ b/wui/conf/ovirt-wui.conf
@@ -28,11 +28,6 @@ ProxyRequests Off
   # RequestHeader unset Authorization
 </Proxy>
 
-RewriteEngine on
-RewriteRule   ^/ovirt$  /ovirt/  [R]
-# To make oVirt the default app on the website uncomment this line:
-#RewriteRule ^/$  /ovirt/  [R] 
-
 Alias /ovirt/stylesheets "/usr/share/ovirt-wui/public/stylesheets"
 Alias /ovirt/images "/usr/share/ovirt-wui/public/images"
 Alias /ovirt/errors "/usr/share/ovirt-wui/public/"
diff --git a/wui/src/test/functional/interface_test.rb b/wui/src/test/functional/interface_test.rb
new file mode 100644
index 0000000..f6b3b28
--- /dev/null
+++ b/wui/src/test/functional/interface_test.rb
@@ -0,0 +1,42 @@
+ 
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+if File.exists? File.dirname(__FILE__) + '/../selenium.rb'
+
+ require File.dirname(__FILE__) + '/../test_helper'
+ require File.dirname(__FILE__) + '/../selenium'
+ 
+ class InterfaceTest < Test::Unit::TestCase
+ 	def setup
+            @browser = Selenium::SeleniumDriver.new("192.168.50.1", 4444,
+                           "*firefox /usr/lib64/firefox-3.0.1/firefox",
+ 		          "http://admin:ovirt 192 168 50 2/ovirt/", 15000)
+            @browser.start 
+ 	end
+ 
+         def test_ovirt
+            @browser.open("http://admin:ovirt 192 168 50 2/ovirt/")
+            assert_equal("Dashboard", @browser.get_title())
+         end
+ 
+         def teardown
+            @browser.stop
+         end
+ end
+
+end
-- 
1.5.4.1


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