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

[Cluster-devel] conga/luci/test congaDemoTests.py conga_Helper ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	ldimaggi sourceware org	2006-12-01 19:57:52

Added files:
	luci/test      : congaDemoTests.py conga_Helpers.py 
	                 conga_suite.py 

Log message:
	Checking in the first revision of the first parts of a test suite for Conga.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&r1=NONE&r2=1.1

/cvs/cluster/conga/luci/test/congaDemoTests.py,v  -->  standard output
revision 1.1
--- conga/luci/test/congaDemoTests.py
+++ -	2006-12-01 19:57:53.065630000 +0000
@@ -0,0 +1,217 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+#  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; either version 2, or (at your option) any
+#  later version.
+#
+#  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; see the file COPYING.  If not, write to the
+#  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
+#  MA 02139, USA.
+
+'''
+Script name:    congaDemoTests.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary:        Simple, demo/prototype test for Conga
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi redhat com>'
+
+from conga_Helpers import *
+from selenium import selenium
+import unittest, time, re
+
+class congaDemoTests(unittest.TestCase):
+
+    def createUsers(self, sel, theUsers):
+        """Common code to create all users in user dictionary"""
+        for userName in theUsers.keys():            
+            print 'Create user: ' + userName
+            sel.click("link=Add a User")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            sel.type("newUserName", userName)
+            sel.type("newPassword", theUsers[userName])     
+            sel.type("newPasswordConfirm", theUsers[userName])
+            sel.click("Submit")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+            # Validation - verify that the success message was displayed for each user
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully')) 
+
+    def deleteUsers(self, sel, theUsers):
+        """"Common code to delete all users in user dictionary"""
+        for userName in theUsers.keys():      
+            print 'Delete user: ' + userName      
+            sel.click("link=Delete a User")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            sel.select("deluserId", "label=" + userName)
+            sel.click("Submit")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+            # Validation - verify that the success message was displayed for each user
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))  
+
+    def createStorageSystems(self, sel, theSystems):
+        """Common code to create storage systems in the input dictionary"""
+        for systemName in theSystems.keys():
+            print 'Create storage system: ' + systemName
+            sel.click("link=Add a System")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            sel.type("__SYSTEM0:Addr", systemName)        
+            sel.type("__SYSTEM0:Passwd", theSystems[systemName])
+            sel.click("Submit")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            # Validation - verify that the success message was displayed for each storage system
+            self.assertEqual("Do you really want to add the following Storage Systems:\n" + systemName, sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))
+
+    def deleteStorageSystems(self, sel, theSystems):
+        """Common code to delete storage systems in the input dictionary"""
+        for systemName in theSystems.keys():            
+            print 'Delete storage system: ' + systemName
+            # Need to handle artifacts names - underscores in strings, not periods
+            systemNameMod = systemName.replace('.', '_')
+            sel.click("name=__SYSTEM:" + systemNameMod)
+            sel.click("document.adminform.Submit")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            # Validation - verify that the success message was displayed for each storage system
+            self.assertEqual("Do you really want to remove the following managed systems:\nStorage Systems:\n-" + systemName, sel.get_confirmation())
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            self.assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+
+    def setUp(self):
+        """Establish connection to selenium server, login to luci """
+        self.verificationErrors = []
+        self.selenium = selenium("localhost", 4444, "*firefox", CONGA_SERVER)
+        self.selenium.start()
+
+        #  Login to the luci web app
+        self.selenium.open(CONGA_SERVER)
+
+        # Wait for "Redirecting, please wait to complete" - it seems like this should not be needed,
+        # but as of 20061130, it still is
+        time.sleep(10)
+        self.selenium.type("__ac_name", CONGA_ADMIN_USERNAME)
+        self.selenium.type("__ac_password", CONGA_ADMIN_PASSWORD)
+        self.selenium.click("submit")
+        self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+ 
+    def test_congaStorage(self):
+        """Test to create and delete storage systems"""
+        sel = self.selenium
+
+        # Create the storage systems
+        self.createStorageSystems(sel, CONGA_STORAGE_SYSTEMS)
+
+        # View the defined storage systems 
+        sel.select_window("null")
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+        # Delete the storage systems
+        self.deleteStorageSystems(sel, CONGA_STORAGE_SYSTEMS)
+
+    def test_congaUsers(self):
+        """Test to create and delete conga users"""
+        sel = self.selenium
+
+        # Create the users
+        self.createUsers (sel, CONGA_USERS)
+
+        # Return to homebase page
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)     
+
+        # Delete the users 
+        self.deleteUsers (sel, CONGA_USERS)
+
+    def test_congaCluster(self):
+        """Test to create and delete a cluster"""
+
+        # TODO - Need to generalize this function - but as of 20061129, note tng3-1 
+        # is not responding to the creation of a cluster
+        sel = self.selenium
+        sel.open("/luci/homebase")
+        sel.click("link=cluster")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=Create a New Cluster")
+
+        # Create the new "testCluster" cluster
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.type("clusterName", "testCluster")
+        print 'Create cluster: testCluster'  
+
+        # Add the nodes to the cluster
+        # Needed to generalize statements like this:
+        #     sel.type("__SYSTEM1:Addr", "tng3-2.lab.msp.redhat.com")
+        #     sel.type("__SYSTEM1:Passwd", "password")
+        #     sel.click("//input[ value='Add Another Row']")
+        systemCounter = 0
+        for systemName in CONGA_CLUSTER_SYSTEMS.keys():
+            sel.type("__SYSTEM" + str(systemCounter) + ":Addr", systemName)
+            sel.type("__SYSTEM" + str(systemCounter) + ":Passwd", CONGA_CLUSTER_SYSTEMS[systemName])
+            systemCounter = systemCounter + 1
+            if (systemCounter > 2):
+                sel.click("//input[ value='Add Another Row']")          
+        sel.click("document.adminform.rhn_dl[1]")
+        sel.click("Submit")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+        self.assertEqual('Add the cluster "testCluster" to the Luci management interface?' , sel.get_confirmation())
+        #sel.click("link=testCluster")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+
+        # Validation - verify that the newly created cluster shows up in the cluster list        
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load("30000")
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load("30000")
+        self.assertTrue (sel.is_text_present('testCluster'))
+        self.assertTrue (sel.is_element_present("name=__CLUSTER:testCluster"))
+
+        # Delete the cluster - note that this only deletes the reference to the cluster
+        # in the luci web app - need to build a way to delete /etc/cluster/cluster.conf
+        # and stop cman service on cluster nodes - TODO - see bug #
+        # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=213076        
+        print 'Delete cluster: testCluster'  
+        sel.click("name=__CLUSTER:testCluster")
+        sel.click("document.adminform.Submit")
+        sel.wait_for_page_to_load("30000")
+        self.assertEqual("Do you really want to remove the following managed systems:\nClusters:\n-testCluster", sel.get_confirmation())
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        self.assertTrue (sel.is_text_present('Removed cluster "testCluster" successfully'))
+        
+        # Delete the storage systems created when the cluster was created
+        self.deleteStorageSystems(sel, CONGA_CLUSTER_SYSTEMS)
+
+    def tearDown(self):
+        """Logout and stop Selenium session"""
+        sel = self.selenium
+        self.selenium.click("link=Log out")
+        self.selenium.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        self.selenium.stop()
+        self.assertEqual([], self.verificationErrors)
+
+def suite():
+        suite = unittest.TestSuite()
+        suite.addTest(congaDemoTests('test_congaStorage'))
+        suite.addTest(congaDemoTests('test_congaUsers'))
+        suite.addTest(congaDemoTests('test_congaCluster'))
+        return suite
+
+if __name__ == "__main__":
+    #unittest.main()
+    unittest.TextTestRunner(verbosity=2).run(suite())
/cvs/cluster/conga/luci/test/conga_Helpers.py,v  -->  standard output
revision 1.1
--- conga/luci/test/conga_Helpers.py
+++ -	2006-12-01 19:57:53.183317000 +0000
@@ -0,0 +1,83 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+#  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; either version 2, or (at your option) any
+#  later version.
+#
+#  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; see the file COPYING.  If not, write to the
+#  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
+#  MA 02139, USA.
+
+'''
+Script name:    conga_Helpers.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary:        Common routines, global variables
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi redhat com>'
+
+from selenium import selenium
+import unittest, time, re
+
+#class congaHelpers(unittest.TestCase):
+
+    # Define data to support tests - global for now
+
+CONGA_ADMIN_USERNAME = 'admin'
+CONGA_ADMIN_PASSWORD = 'password'
+CONGA_SERVER = "http://tng3-5.lab.msp.redhat.com:8080";
+PAGE_DISPLAY_DELAY = "30000"
+
+# 20061130 - Node tng3-1 isn't booting, node tng3-4 is having some problems too
+
+#CONGA_STORAGE_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
+#                         'tng3-2.lab.msp.redhat.com':'password',
+#                         'tng3-3.lab.msp.redhat.com':'password',
+#                         'tng3-4.lab.msp.redhat.com':'password',
+#                         'tng3-5.lab.msp.redhat.com':'password'}
+
+CONGA_STORAGE_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password', 
+                         'tng3-3.lab.msp.redhat.com':'password', 
+                         'tng3-5.lab.msp.redhat.com':'password'}
+
+#CONGA_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
+#                         'tng3-2.lab.msp.redhat.com':'password', 
+#                         'tng3-3.lab.msp.redhat.com':'password', 
+#                         'tng3-4.lab.msp.redhat.com':'password'}
+
+CONGA_CLUSTER_SYSTEMS = {'tng3-2.lab.msp.redhat.com':'password',
+                         'tng3-3.lab.msp.redhat.com':'password',
+                         'tng3-4.lab.msp.redhat.com':'password'}
+
+CONGA_USERS =           {'user1':'user1_password', 
+                         'user2':'user2_password', 
+                         'user3':'user3_password', 
+                         'user4':'user4_password', 
+                         'user5':'user5_password', 
+                         'user6':'user6_password', 
+                         'user7':'user7_password', 
+                         'user8':'user8_password', 
+                         'user9':'user9_password', 
+                         'user10':'user10_password'}
+
+CONGA_USERS_SYSTEMS =   {'user1':'tng3-1.lab.msp.redhat.com', 
+                         'user2':'tng3-1.lab.msp.redhat.com', 
+                         'user3':'tng3-1.lab.msp.redhat.com', 
+                         'user4':'tng3-1.lab.msp.redhat.com', 
+                         'user5':'tng3-1.lab.msp.redhat.com', 
+                         'user6':'tng3-1.lab.msp.redhat.com', 
+                         'user7':'tng3-1.lab.msp.redhat.com', 
+                         'user8':'tng3-1.lab.msp.redhat.com', 
+                         'user9':'tng3-1.lab.msp.redhat.com', 
+                         'user10':'tng3-1.lab.msp.redhat.com'}
/cvs/cluster/conga/luci/test/conga_suite.py,v  -->  standard output
revision 1.1
--- conga/luci/test/conga_suite.py
+++ -	2006-12-01 19:57:53.296094000 +0000
@@ -0,0 +1,66 @@
+#! /usr/bin/env python
+
+# Copyright Red Hat, Inc. 2006
+#
+#  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; either version 2, or (at your option) any
+#  later version.
+#
+#  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; see the file COPYING.  If not, write to the
+#  Free Software Foundation, Inc.,  675 Mass Ave, Cambridge, 
+#  MA 02139, USA.
+
+'''
+Script name:    conga_suite.py
+Creation date:  Dec 2006
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0 (http://www.openqa.org/selenium/)
+Summary:        Simple, demo/prototype test for Conga
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi redhat com>'
+
+# Import the test suites
+import unittest
+import congaDemoTests
+
+# Tests planned - not yet complete:   
+#   CGA-0160_Add_User.py
+#   CGA-0170_Online_Documenation_Portlet.py
+#   CGA-0180_Event_Portlet.py
+#   CGA-0200_Create_cluster.py
+#   CGA-0210_Add_cluster_to_Administer.py
+#   CGA-0220_Add_node_to_cluster.py
+#   CGA-0300_Initialize_Disk_or_Partition.py
+#   CGA-0310_Create_Volume_Group.py
+#   CGA-0311_Activate_Volume_Group.py
+#   CGA-0312_Deactivate_Volume_Group.py
+#   CGA-0313_Remove_Volume_Group.py
+#   CGA-0314_Add_Physical_Volume.py
+#   CGA-0315_Remove_Physical_Volume.py
+#   CGA-0320_Create_Logical_Volume.py
+#   CGA-0321_Remove_Logical_Volume.py
+#   CGA-0322_Extend_Logical_Volume.py
+#   CGA-0323_Reduce_Logical_Volume.py
+#   CGA-0330_Migrate_Data_off_Physical_Volume.py
+#   CGA-0331_Take_Snapshot_Volume.py
+#   CGA-0340_Set_logging_Params.py
+#   CGA-0341_Block_Device_Params.py
+#   CGA-0342_Backup_Archive_Params.py
+
+# Define the suite elements
+congaDemoSuite = congaDemoTests.suite()
+
+# Assemble the suite
+suite = unittest.TestSuite()
+suite.addTest(congaDemoSuite)
+
+# Run the test suite
+unittest.TextTestRunner(verbosity=2).run(suite)


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