From mboxrd@z Thu Jan 1 00:00:00 1970 From: ldimaggi@sourceware.org Date: 8 Dec 2006 16:17:24 -0000 Subject: [Cluster-devel] conga/luci/test CGA_0160_Add_User.py CGA_0170_ ... Message-ID: <20061208161724.18668.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: conga Changes by: ldimaggi at sourceware.org 2006-12-08 16:17:23 Modified files: luci/test : CGA_0160_Add_User.py CGA_0170_Online_Documenation_Portlet.py conga_Helpers.py Added files: luci/test : CGA_0200_Create_cluster.py Log message: Added first revision of test for use case CGA-0200 - create a cluster. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0200_Create_cluster.py.diff?cvsroot=cluster&r1=NONE&r2=1.1 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0160_Add_User.py.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/CGA_0170_Online_Documenation_Portlet.py.diff?cvsroot=cluster&r1=1.1&r2=1.2 http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/test/conga_Helpers.py.diff?cvsroot=cluster&r1=1.5&r2=1.6 /cvs/cluster/conga/luci/test/CGA_0200_Create_cluster.py,v --> standard output revision 1.1 --- conga/luci/test/CGA_0200_Create_cluster.py +++ - 2006-12-08 16:17:24.156579000 +0000 @@ -0,0 +1,117 @@ +#! /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: CGA_0200_Create_cluster.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 ' + +from conga_Helpers import * +from selenium import selenium +import unittest, time, re + +class CGA_0200_Create_cluster(unittest.TestCase): + + def setUp(self): + """Establish connection to selenium server, login to luci """ + self.verificationErrors = [] + self.selenium = login (CONGA_ADMIN_USERNAME, CONGA_ADMIN_PASSWORD) + + 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 + for systemName in CONGA_CLUSTER_SYSTEMS: + deleteStorageSystem(sel, systemName) + # 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 tearDown(self): + """Logout and stop Selenium session""" + logout(self.selenium) + self.assertEqual([], self.verificationErrors) + +def suite(): + suite = unittest.TestSuite() + suite.addTest(CGA_0200_Create_cluster('test_congaCluster')) + return suite + +if __name__ == "__main__": + #unittest.main() + unittest.TextTestRunner(verbosity=2).run(suite()) --- conga/luci/test/CGA_0160_Add_User.py 2006/12/06 19:59:56 1.4 +++ conga/luci/test/CGA_0160_Add_User.py 2006/12/08 16:17:23 1.5 @@ -1,5 +1,22 @@ #! /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: CGA_0160_Add_User.py Creation date: Dec 2006 --- conga/luci/test/CGA_0170_Online_Documenation_Portlet.py 2006/12/07 20:56:48 1.1 +++ conga/luci/test/CGA_0170_Online_Documenation_Portlet.py 2006/12/08 16:17:23 1.2 @@ -1,5 +1,22 @@ #! /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: GA_0170_Online_Documentation_Portlet.py Creation date: Dec 2006 --- conga/luci/test/conga_Helpers.py 2006/12/07 20:56:48 1.5 +++ conga/luci/test/conga_Helpers.py 2006/12/08 16:17:23 1.6 @@ -56,8 +56,8 @@ # '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' } +CONGA_CLUSTER_SYSTEMS = {'tng3-1.lab.msp.redhat.com':'password', + 'tng3-4.lab.msp.redhat.com':'password' } CONGA_USERS = {'user1':'user1_password', 'user2':'user2_password',