def setUpClass(cls): cls.pod_folder = prepare_agent_test_env() _logger.info("Temp POD folder: %s", cls.pod_folder) from ava.runtime.config import settings from ava.core.agent import Agent settings['DEBUG'] = True settings['TEST'] = True os.environ.setdefault(AVA_SWARM_SECRET, swarm_secret) os.environ.setdefault(AVA_AGENT_SECRET, agent_secret) AgentTest.agent = Agent(None, None) gevent.spawn(AgentTest.agent.run) agent_running.wait(10)
def agent(request): from ava.runtime.config import settings from ava.core.agent import Agent pod_folder = prepare_agent_test_env() settings['GENERAL']['TEST'] = True os.environ.setdefault(AVA_SWARM_SECRET, swarm_secret) os.environ.setdefault(AVA_AGENT_SECRET, agent_secret) _agent = Agent(None, None) agent_greenlet = gevent.spawn(_agent.run) agent_running.wait(10) def teardown_agent(): if not agent: return _agent.interrupted = True agent_stopped.wait(10) shutil.rmtree(pod_folder) request.addfinalizer(teardown_agent) return _agent
def agent(request): from ava.runtime.config import settings from ava.core.agent import Agent pod_folder = prepare_agent_test_env() settings['GENERAL']['TEST'] = True os.environ.setdefault(AVA_SWARM_SECRET, swarm_secret) os.environ.setdefault(AVA_AGENT_SECRET, agent_secret) _agent = Agent(None, None) gevent.spawn(_agent.run) agent_running.wait(10) def teardown_agent(): if not agent: return _agent.interrupted = True agent_stopped.wait(10) shutil.rmtree(pod_folder) request.addfinalizer(teardown_agent) return _agent