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

[Cluster-devel] conga/luci/test CGA_0160_Add_User.py CGA_0200_ ...



CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL4
Changes by:	rmccabe sourceware org	2007-02-28 22:58:57

Modified files:
	luci/test      : CGA_0160_Add_User.py CGA_0200_Create_cluster.py 
	                 congaDemoTests.py conga_Helpers.py 
	                 conga_suite.py 
Added files:
	luci/test      : cleaner.py 

Log message:
	sync up the test suite

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/cleaner.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=NONE&r2=1.1.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0160_Add_User.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.1&r2=1.5.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.1&r2=1.2.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/congaDemoTests.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.8.2.1&r2=1.8.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.10.2.2&r2=1.10.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_suite.py.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.7.2.2&r2=1.7.2.3

/cvs/cluster/conga/luci/test/cleaner.py,v  -->  standard output
revision 1.1.2.1
--- conga/luci/test/cleaner.py
+++ -	2007-02-28 22:58:58.426965000 +0000
@@ -0,0 +1,102 @@
+#! /usr/bin/env python
+
+'''
+Script name:    cleaner.py
+Creation date:  Feb 2007
+Purpose:        Prototype automated GUI test for RHEL5 Conga (luci server web app) - automated
+                with Selenium RC (remote control) 0.9.0
+Summary:        Script to clean up all Conga test suite related artifacts - this script will be 
+                before Conga use case tests
+'''
+
+__author__ = 'Len DiMaggio <ldimaggi redhat com>'
+
+from selenium import selenium
+import unittest, time, re
+from conga_Helpers import *
+import time
+import logging
+from loggerObject import loggerObject
+
+class cleaner:
+    
+    def cleanup(self):
+
+        selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD)
+        sel = selenium
+        theloggerObject = setupLogger (CONGA_DEBUG_LOG)
+        logger = theloggerObject.getLogger()
+        
+        # Step 1 of 3 - Delete all clusters
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=cluster")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        
+        #####################
+            
+            
+        junk = sel.get_text("cluster_action")
+        print junk
+        print sel.get_body_text()
+        print '============================='
+        
+                
+        tempBool = sel.is_element_present("cluster_action")
+        if (tempBool == True):
+            sel.select("cluster_action", "label=Delete this cluster")
+            sel.click("//input[ value='Go']")
+            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+            time.sleep(300)
+        else:
+            print 'No cluster to delete'
+           
+        sel.click("link=homebase")
+        
+        # Create the users
+#        for userName in CONGA_USERS.keys(): 
+#            createUser (sel, userName, CONGA_USERS[userName], logger)
+#            # Validation - verify that the success message was displayed for each user
+#            assertEqual('Do you really want to add the user "' + userName + '"?', sel.get_confirmation())
+#            sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+#            assertTrue (sel.is_text_present('Added new user "' + userName + '" successfully')) 
+#     
+###############################################################################
+        # Delete the users 
+        for userName in CONGA_USERS.keys(): 
+            deleteUser (sel, userName, logger)
+            # Validation - verify that the success message was displayed for each user
+            try:
+                assertEqual('Do you really want to remove the user "' + userName + '"?', sel.get_confirmation())
+                sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+                assertTrue (sel.is_text_present('User "' + userName + '" has been deleted'))  
+            except:
+                print 'Unable to delete user: ' + userName + ' does it exist?'
+    
+        
+#        # Create the storage systems
+#        for systemName in CONGA_STORAGE_SYSTEMS:
+#            createStorageSystem(sel, systemName, CONGA_STORAGE_SYSTEMS[systemName], logger)
+#            # Validation - verify that the success message was displayed for each storage system
+#            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)
+#            assertTrue (sel.is_text_present('Added storage system "' + systemName + '" successfully'))            
+#            
+
+        tempBool = sel.is_element_present("link=Manage Systems")
+        if (tempBool == True):
+             # Delete the storage systems
+            for systemName in CONGA_STORAGE_SYSTEMS:
+                deleteStorageSystem(sel, systemName, logger)
+                try:
+                    # Validation - verify that the success message was displayed for each storage system
+                    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)
+                    assertTrue (sel.is_text_present('Removed storage system "' + systemName + '" successfully'))
+                except:
+                    print 'Unable to delete system: ' + systemName + ' does it exist?'
+        else:
+            print 'No systems to delete'
+           
+        sel = selenium.stop()
+             
\ No newline at end of file
--- conga/luci/test/CGA_0160_Add_User.py	2007/02/10 00:01:22	1.5.2.1
+++ conga/luci/test/CGA_0160_Add_User.py	2007/02/28 22:58:57	1.5.2.2
@@ -140,7 +140,7 @@
                     #print "DEBUG - loggedInUser=" + loggedInUser + " userName=" + userName
                     if (loggedInUser == userName):
                         # Validation 1 - seeing authorized systems
-                        print 'Verify user ' + userName + ' is able to access authorized systems'
+                        self.logger.info('Verify user ' + userName + ' is able to access authorized systems')
                         self.assertTrue (sel.is_text_present(CONGA_USERS_SYSTEMS[loggedInUser]))
                                                
                         sel.click("link=" + CONGA_USERS_SYSTEMS[loggedInUser])
@@ -157,13 +157,13 @@
                                 self.assertTrue (sel.is_text_present('hda'))
                                 break
                             except:
-                                print 'Failed to view hard disk - assume slow reponse - trying again'
+                                self.logger.info('Failed to view hard disk - assume slow reponse - trying again')
                             loopCounter = loopCounter +1    
                             time.sleep (30)
                         
                     else:
                         # Validation 2 - not seeing other systems
-                        print 'Verify user ' + loggedInUser + ' is not able to access unauthorized system ' + CONGA_USERS_SYSTEMS[userName]
+                        self.logger.info('Verify user ' + loggedInUser + ' is not able to access unauthorized system ' + CONGA_USERS_SYSTEMS[userName])
                         self.assertFalse (sel.is_text_present(CONGA_USERS_SYSTEMS[userName]))
                         
             logout(self.selenium)  
--- conga/luci/test/CGA_0200_Create_cluster.py	2007/02/05 21:27:22	1.2.2.1
+++ conga/luci/test/CGA_0200_Create_cluster.py	2007/02/28 22:58:57	1.2.2.2
@@ -73,7 +73,7 @@
             systemCounter = systemCounter + 1
             if (systemCounter > 2):
                 sel.click("//input[ value='Add Another Row']")          
-        sel.click("document.adminform.rhn_dl[1]")
+        #sel.click("document.adminform.rhn_dl[1]")
         sel.click("Submit")
         sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
 
@@ -81,34 +81,48 @@
         #sel.click("link=testCluster")
         sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
 
+        # Wait 5 minutes for the cluster nodes to be rebooted
+        time.sleep (300)
+
         # 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.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
         sel.click("link=Manage Systems")
-        sel.wait_for_page_to_load("30000")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
         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        
-        self.logger.debug('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'))
         
+        # Then - delete the cluster
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=cluster")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.select("cluster_action", "label=Delete this cluster")
+        sel.click("//input[ value='Go']")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)       
+
         # Delete the storage systems created when the cluster was created
         for systemName in CONGA_SMALL_CLUSTER_SYSTEMS:
-            deleteStorageSystem(sel, systemName)
+            deleteStorageSystem(sel, systemName, self.logger)
            # 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'))
 
+        # And the cluster reference in the storage system list too
+        sel.click("link=homebase")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("link=Manage Systems")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        sel.click("__CLUSTER0")
+        sel.click("document.adminform.Submit")
+        sel.wait_for_page_to_load(PAGE_DISPLAY_DELAY)
+        self.assertEqual("Do you really want to remove the following managed systems:\nClusters:\n-testCluster", sel.get_confirmation())
+
         self.logger.info('Ending test case CGA_0200_Create_cluster.test_congaCluster')
 
     def tearDown(self):
--- conga/luci/test/congaDemoTests.py	2007/02/05 21:27:22	1.8.2.1
+++ conga/luci/test/congaDemoTests.py	2007/02/28 22:58:57	1.8.2.2
@@ -32,11 +32,15 @@
 import unittest, time, re
 import logging
 from loggerObject import loggerObject
+from cleaner import *
 
 class congaDemoTests(unittest.TestCase):
 
     def setUp(self):
         
+        temp = cleaner()    
+        temp.cleanup()
+        
         # Set up logging      
         self.theloggerObject = setupLogger (CONGA_DEBUG_LOG)
         self.logger = self.theloggerObject.getLogger()
@@ -101,71 +105,6 @@
 
         self.logger.info('Ending test case congaDemoTests.test_congaUsers')
 
-    def test_congaCluster(self):
-        """Test to create and delete a cluster"""
-        self.logger.info('Starting test case congaDemoTests.test_congaCluster')
-        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")
-        self.logger.debug('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_SMALL_CLUSTER_SYSTEMS.keys():
-            sel.type("__SYSTEM" + str(systemCounter) + ":Addr", systemName)
-            sel.type("__SYSTEM" + str(systemCounter) + ":Passwd", CONGA_SMALL_CLUSTER_SYSTEMS[systemName])
-            systemCounter = systemCounter + 1
-            if (systemCounter > 2):
-                sel.click("//input[ value='Add another entry']")          
-        #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        
-        self.logger.debug('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
-        for systemName in CONGA_SMALL_CLUSTER_SYSTEMS:
-            deleteStorageSystem(sel, systemName, self.logger)
-           # 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'))
-
-        self.logger.info('Ending test case congaDemoTests.test_congaCluster')
-
     def tearDown(self):
         """Logout and stop Selenium session"""
         logout(self.selenium)
@@ -174,9 +113,8 @@
 
 def suite():
         suite = unittest.TestSuite()
-        suite.addTest(congaDemoTests('test_congaStorage'))
+#        suite.addTest(congaDemoTests('test_congaStorage'))
         suite.addTest(congaDemoTests('test_congaUsers'))
-        #suite.addTest(congaDemoTests('test_congaCluster'))
         return suite
 
 if __name__ == "__main__":
--- conga/luci/test/conga_Helpers.py	2007/02/10 00:01:22	1.10.2.2
+++ conga/luci/test/conga_Helpers.py	2007/02/28 22:58:57	1.10.2.3
@@ -31,7 +31,6 @@
 import unittest, time, re
 import logging
 import logging.handlers
- 
 from loggerObject import loggerObject
 
 # Define data to support tests - global for now
@@ -39,7 +38,7 @@
 CONGA_ADMIN_USERNAME = 'admin'
 CONGA_ADMIN_PASSWORD = 'password'
 CONGA_SERVER = 'http://tng3-5.lab.msp.redhat.com:8080'
-PAGE_DISPLAY_DELAY = '30000'
+PAGE_DISPLAY_DELAY = '60000'
 CONGA_LOG = '/var/tmp/congaTest.log'
 CONGA_DEBUG_LOG = '/var/tmp/congaTest_debug.log'
 
@@ -56,7 +55,7 @@
                          'tng3-3.lab.msp.redhat.com':'password',
                          'tng3-4.lab.msp.redhat.com':'password' }
 
-CONGA_LARGE_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', 
+CONGA_LARGE_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',
@@ -108,12 +107,15 @@
 
 def deleteStorageSystem(sel, systemName, theLogger):
     """Common code to delete storage systems"""
-    theLogger.debug('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)          
+    try:
+        theLogger.debug('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)          
+    except:
+        print 'Unable to delete system: ' + systemName
 
 def createUser(sel, userName, userPassword, theLogger):
     """Common code to create users"""
@@ -128,12 +130,15 @@
     
 def deleteUser(sel, userName, theLogger):
     """Common code to delete users"""
-    theLogger.debug('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)    
+    try:
+        theLogger.debug('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)    
+    except:
+        print 'Unable to delete user: ' + userName
         
 def login(userName, password):
     """Establish connection to selenium server, login to luci """
@@ -185,4 +190,4 @@
     theLogger.removeHandler(theHandler)
     theHandler.close()
 #    theHandler.doRollover()
-    
\ No newline at end of file
+    
--- conga/luci/test/conga_suite.py	2007/02/10 00:01:22	1.7.2.2
+++ conga/luci/test/conga_suite.py	2007/02/28 22:58:57	1.7.2.3
@@ -67,10 +67,10 @@
 
 # Assemble the suite
 suite = unittest.TestSuite()
-#suite.addTest(congaDemoSuite)
+suite.addTest(congaDemoSuite)
 suite.addTest(CGA_0160_Add_UserSuite)
-#suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
-#suite.addTest(CGA_0200_Create_cluster_Suite)
+suite.addTest(CGA_0170_Online_Documentation_Portlet_Suite)
+suite.addTest(CGA_0200_Create_cluster_Suite)
 
 # Run the test suite
 unittest.TextTestRunner(verbosity=2).run(suite)


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