eclipse-volttron / volttron-testing

Other
0 stars 5 forks source link

volttron_instance fixture fails to cleanup because of timeout #14

Closed bonicim closed 1 year ago

bonicim commented 2 years ago

Describe the bug When using the volttron_instance fixture, the cleanup_wrapper function times out when it tries to get a list of agents. The timeout occurs at this line of code.

To Reproduce Steps to reproduce the behavior:

  1. Create an integration test that uses this fixture
  2. Run the test using pytest -v -s
  3. Wait until tests finish; you should see error logs.

Expected behavior

From pytests:


request = <SubRequest 'volttron_instance' for <Function test_platform_driver_agent_successful_install_on_volttron_platform[volttron_instance0]>>
kwargs = {}, address = 'tcp://127.0.0.175:5546', wrapper = volttron_home: /tmp/tmpw64u19ez/volttron_home, wrapper_pid = 176245

    @pytest.fixture(scope="module",
                    params=[
                        dict(messagebus='zmq', ssl_auth=False),
                        pytest.param(dict(messagebus='rmq', ssl_auth=True), marks=rmq_skipif),
                    ])
    def volttron_instance(request, **kwargs):
        """Fixture that returns a single instance of volttron platform for volttrontesting

        @param request: pytest request object
        @return: volttron platform instance
        """
        address = kwargs.pop("vip_address", get_rand_vip())
        wrapper = build_wrapper(address,
                                messagebus=request.param['messagebus'],
                                ssl_auth=request.param['ssl_auth'],
                                **kwargs)
        wrapper_pid = wrapper.p_process.pid

        try:
            yield wrapper
        except Exception as ex:
            print(ex.args)
        finally:
>           cleanup_wrapper(wrapper)

.venv/lib/python3.8/site-packages/volttrontesting/fixtures/volttron_platform_fixtures.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.venv/lib/python3.8/site-packages/volttrontesting/fixtures/volttron_platform_fixtures.py:60: in cleanup_wrapper
    wrapper.shutdown_platform()
.venv/lib/python3.8/site-packages/volttrontesting/platformwrapper.py:1437: in shutdown_platform
    for agnt in self.list_agents():
.venv/lib/python3.8/site-packages/volttrontesting/platformwrapper.py:1211: in list_agents
    agent_list = self.dynamic_agent.vip.rpc('control', 'list_agents').get(timeout=10)
src/gevent/event.py:329: in gevent._gevent_cevent.AsyncResult.get
    ???
src/gevent/event.py:356: in gevent._gevent_cevent.AsyncResult.get
    ???
src/gevent/_abstract_linkable.py:487: in gevent._gevent_c_abstract_linkable.AbstractLinkable._wait_core
    ???
src/gevent/_abstract_linkable.py:490: in gevent._gevent_c_abstract_linkable.AbstractLinkable._wait_core
    ???
src/gevent/_abstract_linkable.py:442: in gevent._gevent_c_abstract_linkable.AbstractLinkable._AbstractLinkable__wait_to_be_notified
    ???
src/gevent/_abstract_linkable.py:451: in gevent._gevent_c_abstract_linkable.AbstractLinkable._switch_to_hub
    ???
src/gevent/_greenlet_primitives.py:61: in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
    ???
src/gevent/_greenlet_primitives.py:65: in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   gevent.timeout.Timeout: 10 seconds

src/gevent/_gevent_c_greenlet_primitives.pxd:35: Timeout
====================================================== short test summary info =======================================================
ERROR tests/test_agent_integ.py::test_platform_driver_agent_successful_install_on_volttron_platform[volttron_instance1] - gevent.ti...
========================================= 1 passed, 1 skipped, 1 error in 137.87s (0:02:17) ==========================================

Screenshots If applicable, add screenshots to help explain your problem.

System (please complete the following information):

Additional context Add any other context about the problem here.