]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Bring back testcontainermanager and testresourcemanager to salome test.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 1 Jul 2016 14:51:19 +0000 (16:51 +0200)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Fri, 1 Jul 2016 14:51:19 +0000 (16:51 +0200)
src/LifeCycleCORBA_SWIG/Test/CMakeLists.txt
src/LifeCycleCORBA_SWIG/Test/CTestTestfileInstall.cmake
src/LifeCycleCORBA_SWIG/Test/CatalogResources_resource.xml [new file with mode: 0644]
src/LifeCycleCORBA_SWIG/Test/testcontainermanager.py
src/LifeCycleCORBA_SWIG/Test/testresourcemanager.py

index 57556dd0f00f45754e9c05c9a5208886393da238..3800e9ad731139aa0e6cb34a48784880495446db 100755 (executable)
@@ -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)
index 7cd5ec5b48d828fa287bade5b765cb7c9d737be0..41193da891ee25774fe84139931ca82d71c71bf4 100644 (file)
@@ -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 (file)
index 0000000..38be2c0
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE ResourcesCatalog>
+<resources>
+   <machine hostname="m1" />
+   <machine hostname="m2" />
+   <machine hostname="m3" >
+     <modules moduleName="tutu" />
+   </machine>
+   <machine hostname="m4" >
+     <component name="sub" moduleName="tata" />
+   </machine>
+   <machine hostname="claui2c6" >
+     <modules moduleName="toto" />
+     <component name="add" moduleName="titi" />
+   </machine>
+</resources>
index 0abe231dc6489d4319bf35318c56bc5e22c404db..ea3dd25adde26198e45da2379d0811e4ac331d19 100644 (file)
@@ -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__':
index da93f12316008ee35a5bf49f9e8e0151b2dc696b..2e2712dbf65c4627dee7cf7fd4fc97bc98db637f 100644 (file)
@@ -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")