Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup_wrapper(wrapper) cannot handle env[SKIP_CLEANUP=True] #37

Open
kefeimo opened this issue Apr 18, 2023 · 0 comments
Open

cleanup_wrapper(wrapper) cannot handle env[SKIP_CLEANUP=True] #37

kefeimo opened this issue Apr 18, 2023 · 0 comments

Comments

@kefeimo
Copy link

kefeimo commented Apr 18, 2023

As seen in the following log

            f"{str(Path(wrapper.volttron_home).parent)} wasn't cleaned!"

Didn't take into account when environment variable SKIP_CLEANUP=True

Expected result: handle SKIP_CLEANUP=True


    @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)

../../sandbox-volttron/env/lib/python3.10/site-packages/volttrontesting/fixtures/volttron_platform_fixtures.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

wrapper = volttron_home: /tmp/tmpjdt71_ns/volttron_home

    def cleanup_wrapper(wrapper):
        print('Shutting down instance: {0}, MESSAGE BUS: {1}'.format(wrapper.volttron_home, wrapper.messagebus))
        # if wrapper.is_running():
        #     wrapper.remove_all_agents()
        # Shutdown handles case where the platform hasn't started.
        wrapper.shutdown_platform()
        if wrapper.p_process is not None:
            if psutil.pid_exists(wrapper.p_process.pid):
                proc = psutil.Process(wrapper.p_process.pid)
                proc.terminate()
        if not wrapper.debug_mode:
>           assert not Path(wrapper.volttron_home).parent.exists(), \
                f"{str(Path(wrapper.volttron_home).parent)} wasn't cleaned!"
E           AssertionError: /tmp/tmpjdt71_ns wasn't cleaned!

../../sandbox-volttron/env/lib/python3.10/site-packages/volttrontesting/fixtures/volttron_platform_fixtures.py:90: AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant