

def test_jobs_load_from_legacy_plugins(self):
    'Test the configured plugins are loaded from legacy config.yaml layout'
    self.start_server()
    self.assertFalse(self.worker_server.stopped())
    self.assertEqual(3, len(self.worker_server.jobs))
    expected_jobs = {
        'build:real-db-upgrade_nova_mysql_devstack_131007': {
            'name': 'build:real-db-upgrade_nova_mysql_devstack_131007',
            'plugin': 'real_db_upgrade',
            'runner_module_name': 'turbo_hipster.task_plugins.real_db_upgrade.task',
            'plugin_config': {
                'name': 'real_db_upgrade',
                'datasets_dir': '/var/lib/turbo-hipster/datasets_devstack_131007',
                'function': 'build:real-db-upgrade_nova_mysql_devstack_131007',
            },
        },
        'build:real-db-upgrade_nova_mysql_user_001': {
            'name': 'build:real-db-upgrade_nova_mysql_user_001',
            'plugin': 'real_db_upgrade',
            'runner_module_name': 'turbo_hipster.task_plugins.real_db_upgrade.task',
            'plugin_config': {
                'name': 'real_db_upgrade',
                'datasets_dir': '/var/lib/turbo-hipster/datasets_user_001',
                'function': 'build:real-db-upgrade_nova_mysql_user_001',
            },
        },
        'build:do_something_shelly': {
            'name': 'build:do_something_shelly',
            'plugin': 'shell_script',
            'runner_module_name': 'turbo_hipster.task_plugins.shell_script.task',
            'job_config': {
                'name': 'build:do_something_shelly',
                'shell_script': 'ls -lah && echo',
            },
        },
    }
    for (job_name, job) in self.worker_server.jobs.items():
        self.assertEqual(expected_jobs[job_name]['name'], job['name'])
        self.assertEqual(expected_jobs[job_name]['plugin'], job['plugin'])
        if ('plugin_config' in job):
            self.assertEqual(expected_jobs[job_name]['plugin_config'], job['plugin_config'])
        if ('job_config' in job):
            self.assertEqual(expected_jobs[job_name]['job_config'], job['job_config'])
        self.assertEqual(expected_jobs[job_name]['runner_module_name'], job['runner'].__module__)

dataset/ETHPy150Open openstack/turbo-hipster/tests/disabled_worker_manager.py TestWorkerServer.test_jobs_load_from_legacy_plugins/original