X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b73985d8a0c9173aec57f6a81fe540b2813a5bff..98db65de63c9e2acfeae6636ccc619171635bda0:/services/fuse/tests/test_token_expiry.py diff --git a/services/fuse/tests/test_token_expiry.py b/services/fuse/tests/test_token_expiry.py index 415f9bbc48..040db2e096 100644 --- a/services/fuse/tests/test_token_expiry.py +++ b/services/fuse/tests/test_token_expiry.py @@ -1,3 +1,8 @@ +# Copyright (C) The Arvados Authors. All rights reserved. +# +# SPDX-License-Identifier: AGPL-3.0 + +from builtins import range import apiclient import arvados import arvados_fuse @@ -28,14 +33,19 @@ class TokenExpiryTest(IntegrationTest): def fake_open(self, operations, *args, **kwargs): self.time_now += 86400*13 logger.debug('opening file at time=%f', self.time_now) - return self.orig_open(operations, *args, **kwargs) + return TokenExpiryTest.orig_open(operations, *args, **kwargs) @mock.patch.object(arvados_fuse.Operations, 'open', autospec=True) - @mock.patch('time.time') + @mock.patch.object(time, 'time', return_value=0) @mock.patch('arvados.keep.KeepClient.get') @IntegrationTest.mount(argv=['--mount-by-id', 'zzz']) def test_refresh_old_manifest(self, mocked_get, mocked_time, mocked_open): - mocked_get.return_value = 'fake data' + # This test (and associated behavior) is still not strong + # enough. We should ensure old tokens are never used even if + # blobSignatureTtl seconds elapse between open() and + # read(). See https://dev.arvados.org/issues/10008 + + mocked_get.return_value = b'fake data' mocked_time.side_effect = self.fake_time mocked_open.side_effect = self.fake_open