From: Ovidiu Mircescu Date: Fri, 1 Jul 2016 14:51:19 +0000 (+0200) Subject: Bring back testcontainermanager and testresourcemanager to salome test. X-Git-Tag: V8_1_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a4b1067cab9e139594d04c883da23bd218a2bd70;p=modules%2Fkernel.git Bring back testcontainermanager and testresourcemanager to salome test. --- diff --git a/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt index 57556dd0f..3800e9ad7 100755 --- a/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt +++ b/src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt @@ -23,6 +23,7 @@ SET(SCRIPTS testresourcemanager.py testcontainermanager.py TestLifeCycleCORBA_SWIG.py + CatalogResources_resource.xml ) SET(LOCAL_TEST_DIR ${KERNEL_TEST_DIR}/LifeCycleCORBA_SWIG) diff --git a/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake b/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake index 7cd5ec5b4..41193da89 100644 --- a/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake +++ b/src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake @@ -19,8 +19,7 @@ SET(TEST_NAMES LifeCycleCORBA_SWIGTest -# testresourcemanager -# testcontainermanager + testcontainermanager # TestLifeCycleCORBA_SWIG ) @@ -31,4 +30,11 @@ IF(NOT WIN32) SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" ) ENDFOREACH() + + # resource manager test needs specific CatalogResouces file in test directory + SET(TEST_NAME ${COMPONENT_NAME}_LC_testresourcemanager) + ADD_TEST(${TEST_NAME} python ${SALOME_TEST_DRIVER} ${TIMEOUT} testresourcemanager.py) + SET_TESTS_PROPERTIES(${TEST_NAME} PROPERTIES LABELS "${COMPONENT_NAME}" + ENVIRONMENT "USER_CATALOG_RESOURCES_FILE=CatalogResources_resource.xml" + ) ENDIF() diff --git a/src/LifeCycleCORBA_SWIG/Test/CatalogResources_resource.xml b/src/LifeCycleCORBA_SWIG/Test/CatalogResources_resource.xml new file mode 100644 index 000000000..38be2c067 --- /dev/null +++ b/src/LifeCycleCORBA_SWIG/Test/CatalogResources_resource.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py index 0abe231dc..ea3dd25ad 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py @@ -45,27 +45,39 @@ Test with catalog : rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="start",resource_params=rp) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") + host1=co.getHostName() + name1="/Containers/%s/MyContainer" % host1 + self.assertEqual(co._get_name(), name1) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") + host2=co.getHostName() + name2="/Containers/%s/MyContainer" % host2 + self.assertEqual(co._get_name(), name2) def test1(self): """""" rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="get",resource_params=rp) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") + host1=co.getHostName() + name1="/Containers/%s/MyContainer" % host1 + self.assertEqual(co._get_name(), name1) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") + host2=co.getHostName() + name2="/Containers/%s/MyContainer" % host2 + self.assertEqual(co._get_name(), name2) def test2(self): """""" rp=LifeCycleCORBA.ResourceParameters(policy="best",componentList=["PYHELLO"]) p=LifeCycleCORBA.ContainerParameters(container_name="MyContainer",mode="getorstart",resource_params=rp) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/claui2c6/MyContainer") + host1=co.getHostName() + name1="/Containers/%s/MyContainer" % host1 + self.assertEqual(co._get_name(), name1) co=cm.GiveContainer( p ) - self.assertEqual(co._get_name(), "/Containers/clt10br/MyContainer") + host2=co.getHostName() + name2="/Containers/%s/MyContainer" % host2 + self.assertEqual(co._get_name(), name2) if __name__ == '__main__': diff --git a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py index da93f1231..2e2712dbf 100644 --- a/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py +++ b/src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py @@ -60,40 +60,43 @@ Test with CatalogResources.xml: self.assertRaises(SALOME.SALOME_Exception,rm.GetFittingResources,params) def test2(self): - """component add required""" + """component add required. + If a resource doesn't have any module or component defined in the catalog, + it means that it has every module and component and it fits for any request. + """ params=LifeCycleCORBA.ResourceParameters(componentList=["add"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) + self.assertEqual(machineList, ['claui2c6', 'localhost', 'm1', 'm2']) def test3(self): """component tutu required""" params=LifeCycleCORBA.ResourceParameters(componentList=["tutu"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['m1', 'm2', 'm3']) + self.assertEqual(machineList, ['localhost', 'm1', 'm2', 'm3']) def test4(self): """component tata required""" params=LifeCycleCORBA.ResourceParameters(componentList=["tata"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['m1', 'm2']) + self.assertEqual(machineList, ['localhost', 'm1', 'm2']) def test5(self): """component titi required""" params=LifeCycleCORBA.ResourceParameters(componentList=["titi"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['m1', 'm2']) + self.assertEqual(machineList, ['localhost', 'm1', 'm2']) def test6(self): """component toto required""" params=LifeCycleCORBA.ResourceParameters(componentList=["toto"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) + self.assertEqual(machineList, ['claui2c6', 'localhost', 'm1', 'm2']) def test7(self): """components add and toto required""" params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) machineList=rm.GetFittingResources(params) - self.assertEqual(machineList, ['claui2c6', 'm1', 'm2']) + self.assertEqual(machineList, ['claui2c6', 'localhost', 'm1', 'm2']) def test8(self): """components add and toto required""" @@ -105,9 +108,11 @@ Test with CatalogResources.xml: params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('altcycl',machineList), "claui2c6") + self.assertEqual(rm.Find('altcycl',machineList), "localhost") self.assertEqual(rm.Find('altcycl',machineList), "m1") self.assertEqual(rm.Find('altcycl',machineList), "m2") self.assertEqual(rm.Find('altcycl',machineList), "claui2c6") + self.assertEqual(rm.Find('altcycl',machineList), "localhost") self.assertEqual(rm.Find('altcycl',machineList), "m1") self.assertEqual(rm.Find('altcycl',machineList), "m2") @@ -116,9 +121,11 @@ Test with CatalogResources.xml: params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('cycl',machineList), "claui2c6") + self.assertEqual(rm.Find('cycl',machineList), "localhost") self.assertEqual(rm.Find('cycl',machineList), "m1") self.assertEqual(rm.Find('cycl',machineList), "m2") self.assertEqual(rm.Find('cycl',machineList), "claui2c6") + self.assertEqual(rm.Find('cycl',machineList), "localhost") self.assertEqual(rm.Find('cycl',machineList), "m1") self.assertEqual(rm.Find('cycl',machineList), "m2") @@ -134,9 +141,11 @@ Test with CatalogResources.xml: params=LifeCycleCORBA.ResourceParameters(componentList=["add","toto"]) machineList=rm.GetFittingResources(params) self.assertEqual(rm.Find('best',machineList), "claui2c6") + self.assertEqual(rm.Find('best',machineList), "localhost") self.assertEqual(rm.Find('best',machineList), "m1") self.assertEqual(rm.Find('best',machineList), "m2") self.assertEqual(rm.Find('best',machineList), "claui2c6") + self.assertEqual(rm.Find('best',machineList), "localhost") self.assertEqual(rm.Find('best',machineList), "m1") self.assertEqual(rm.Find('best',machineList), "m2")