def test_populate(self, mocked_init, mocked_Logger, mocked_Profiler, res_descr): rmgr = Rmgr({'resource':'localhost'}, 'test_rmgr', 'rp', 'test_config') rmgr._validated = False rmgr._resource_desc = res_descr rmgr._logger = mocked_Logger rmgr._prof = mocked_Profiler rmgr._uid = 'rmgr.0000' with self.assertRaises(EnTKError): rmgr._populate() rmgr._validated = True rmgr._resource_desc = res_descr rmgr._logger = mocked_Logger rmgr._prof = mocked_Profiler rmgr._uid = 'rmgr.0000' rmgr._populate() self.assertEqual(rmgr._resource, res_descr['resource']) self.assertEqual(rmgr._walltime, res_descr['walltime']) self.assertEqual(rmgr._cpus, res_descr['cpus']) self.assertEqual(rmgr._gpus, res_descr['gpus']) self.assertEqual(rmgr._project, res_descr['project']) self.assertEqual(rmgr._access_schema, res_descr['access_schema']) self.assertEqual(rmgr._queue, res_descr['queue'])
def test_validate(self, mocked_init, mocked_Logger, mocked_Profiler, res_descr): rmgr = Rmgr({'resource':'localhost'}, 'test_rmgr', 'rp', 'test_config') rmgr._resource_desc = res_descr rmgr._rts_config = {'rts': 'some_rts'} rmgr._logger = mocked_Logger rmgr._prof = mocked_Profiler rmgr._uid = 'rmgr.0000' self.assertTrue(rmgr._validate_resource_desc()) self.assertTrue(rmgr._validated) rmgr._resource_desc = {'resource' : 'localhost', 'walltime' : 30, 'cpus' : 1, 'gpus' : 1, 'project' : 'some_project', 'access_schema' : 'access', 'queue' : 'queue'} rmgr._rts_config = None with self.assertRaises(TypeError): rmgr._validate_resource_desc()