ripe-atlas-tools icon indicating copy to clipboard operation
ripe-atlas-tools copied to clipboard

`test_report` and `test_traceroute_as_path` are impure

Open RaitoBezarius opened this issue 1 year ago • 1 comments

I'm packaging ripe-atlas-tools for NixOS and running the tests in sandbox environment is usually done as part of our packaging process.

It seems like there is some cache mechanisms for some IP machinery and it is trying to get or create a path to the cache based on $HOME :

FAILED tests/commands/test_report.py::TestReportCommand::test_arg_from_file
FAILED tests/commands/test_report.py::TestReportCommand::test_arg_from_stdin
FAILED tests/renderers/test_traceroute_aspath.py::TestTracerouteASPathRenderer::test_arg_radius
FAILED tests/renderers/test_traceroute_aspath.py::TestTracerouteASPathRenderer::test_basic
tests/renderers/test_traceroute_aspath.py:43: in run_renderer
    output += renderer.on_result(Result.get(res))
/nix/store/knn7lhskvyf9l53j0f318cj9vj1yr004-ripe-atlas-tools-3.0.2/lib/python3.10/site-packages/ripe/atlas/tools/renderers/traceroute_aspath.py:82: in on_result
    ip = IP(address)
/nix/store/knn7lhskvyf9l53j0f318cj9vj1yr004-ripe-atlas-tools-3.0.2/lib/python3.10/site-packages/ripe/atlas/tools/ipdetails.py:46: in __init__
    details = self._get_details()
/nix/store/knn7lhskvyf9l53j0f318cj9vj1yr004-ripe-atlas-tools-3.0.2/lib/python3.10/site-packages/ripe/atlas/tools/ipdetails.py:58: in _get_details
    details = cache.get("IPDetails:{}".format(self.address))
/nix/store/knn7lhskvyf9l53j0f318cj9vj1yr004-ripe-atlas-tools-3.0.2/lib/python3.10/site-packages/ripe/atlas/tools/cache.py:73: in get
    if key in self._db:
/nix/store/knn7lhskvyf9l53j0f318cj9vj1yr004-ripe-atlas-tools-3.0.2/lib/python3.10/site-packages/ripe/atlas/tools/cache.py:48: in _db
    self._db_file = dbm.open(self._get_or_create_db_path(), "c")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

file = '/homeless-shelter/.config/ripe-atlas-tools/cache-3.10.6.db', flag = 'c'
mode = 438

    def open(file, flag='r', mode=0o666): [...]
E       _gdbm.error: [Errno 2] No such file or directory: '/homeless-shelter/.config/ripe-atlas-tools/cache-3.10.6.db'

/nix/store/xf1k5k05vg3zn7dfcpfh1qa7ga48hi3m-python3-3.10.6/lib/python3.10/dbm/__init__.py:95: error

I'm not exactly sure the tests were meant to install a path in $XDG_CONFIG_PATH/ripe-atlas-tools, what do you think?

RaitoBezarius avatar Aug 23 '22 10:08 RaitoBezarius