From 0b807e8da320b98b6ba05a6e3c49a05385ca501b Mon Sep 17 00:00:00 2001 From: Emma Turetsky Date: Tue, 30 Jul 2024 14:23:44 -0500 Subject: [PATCH] Info now does its head request to a cache instead of the collections-url -- Adjusted the test to account for the extra head request when doing an initial cache check --- src/pelicanfs/core.py | 10 ++++------ test/test_director.py | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/pelicanfs/core.py b/src/pelicanfs/core.py index 1ebc535..95dafc4 100644 --- a/src/pelicanfs/core.py +++ b/src/pelicanfs/core.py @@ -467,12 +467,6 @@ async def _glob(self, path, maxdepth=None, **kwargs): else: return list(out) - - @_dirlist_dec - async def _info(self, path, **kwargs): - results = await self.httpFileSystem._info(path, **kwargs) - return self._remove_host_from_paths(results) - @_dirlist_dec async def _du(self, path, total=True, maxdepth=None, **kwargs): return await self.httpFileSystem._du(path, total, maxdepth, **kwargs) @@ -628,6 +622,10 @@ async def _exists(self, path, **kwargs): async def _get_file(self, rpath, lpath, **kwargs): return await self.httpFileSystem._get_file(rpath, lpath, **kwargs) + @_cache_dec + async def _info(self, path, **kwargs): + results = await self.httpFileSystem._info(path, **kwargs) + return self._remove_host_from_paths(results) @_cache_multi_dec async def _cat(self, path, recursive=False, on_error="raise", batch_size=None, **kwargs): diff --git a/test/test_director.py b/test/test_director.py index f0beaf4..fb2c1f7 100644 --- a/test/test_director.py +++ b/test/test_director.py @@ -155,6 +155,7 @@ def test_info(httpserver: HTTPServer, get_client): "X-Pelican-Namespace": "namespace=/foo" }, ) + httpserver.expect_oneshot_request("/foo/bar", method="HEAD").respond_with_data(listing_response) httpserver.expect_request("/foo/bar", method="GET").respond_with_data(listing_response) pelfs = pelicanfs.core.PelicanFileSystem( httpserver.url_for("/"),