'Test the migration path for haproxy.
This test will launch the simple_daemon Python process before spawning
haproxy. When launching haproxy, it will be detected and killed, as
it\'s running on the same pidfile and with the router uuid in its
cmdline.'

def test_haproxy_migration_path(self):

    get_temp_file_path = functools.partial(self.get_temp_file_path, root=self.useFixture(fixtures.TempDir()))
    cfg.CONF.set_override('external_pids', get_temp_file_path('external/pids'))
    self.agent.conf.set_override('external_pids', get_temp_file_path('external/pids'))
    router_info = self.generate_router_info(enable_ha=False)
    _callback = self._make_cmdline_callback(router_info['id'])
    pm = external_process.ProcessManager(conf=cfg.CONF, uuid=router_info['id'], default_cmd_callback=_callback)
    pm.enable()
    self.addCleanup(pm.disable)
    self.assertIn('simple_daemon', pm.cmdline)
    self.manage_router(self.agent, router_info)
    self.assertNotIn('simple_daemon', pm.cmdline)
    self.assertIn('haproxy', pm.cmdline)
