From e090301959d7ef5a5de8e4c0e3a1f373d2c4c7c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Thu, 21 Nov 2019 07:16:26 +0100 Subject: tests: source_determinism.py: Do not use too restrictive test umasks To protect the local cache of buildbox-casd from corruption without the use of FUSE, buildbox-casd has to run as a different user. Use less restrictive umasks in the source determinism tests to allow buildbox-casd to function when it is running as a separate user. --- src/buildstream/testing/_sourcetests/source_determinism.py | 9 +++++++-- tests/integration/source-determinism.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/buildstream/testing/_sourcetests/source_determinism.py b/src/buildstream/testing/_sourcetests/source_determinism.py index 27664e0c2..f84d18ba2 100644 --- a/src/buildstream/testing/_sourcetests/source_determinism.py +++ b/src/buildstream/testing/_sourcetests/source_determinism.py @@ -23,7 +23,7 @@ import os import pytest from buildstream import _yaml -from .._utils.site import HAVE_SANDBOX +from .._utils.site import HAVE_SANDBOX, CASD_SEPARATE_USER from .. import create_repo from .. import cli # pylint: disable=unused-import from .utils import kind # pylint: disable=unused-import @@ -101,4 +101,9 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind): os.umask(old_umask) cli.remove_artifact_from_cache(project, element_name) - assert get_value_for_umask(0o022) == get_value_for_umask(0o077) + if CASD_SEPARATE_USER: + # buildbox-casd running as separate user of the same group can't + # function in a test environment with a too restrictive umask. + assert get_value_for_umask(0o002) == get_value_for_umask(0o007) + else: + assert get_value_for_umask(0o022) == get_value_for_umask(0o077) diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py index a349f9eeb..14559759d 100644 --- a/tests/integration/source-determinism.py +++ b/tests/integration/source-determinism.py @@ -6,7 +6,7 @@ import pytest from buildstream import _yaml from buildstream.testing import cli_integration as cli # pylint: disable=unused-import -from buildstream.testing._utils.site import HAVE_SANDBOX +from buildstream.testing._utils.site import HAVE_SANDBOX, CASD_SEPARATE_USER DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project") @@ -69,4 +69,9 @@ def test_deterministic_source_local(cli, tmpdir, datafiles): finally: cli.remove_artifact_from_cache(project, element_name) - assert get_value_for_mask(0o7777) == get_value_for_mask(0o0700) + if CASD_SEPARATE_USER: + # buildbox-casd running as separate user of the same group can't + # read files with too restrictive permissions. + assert get_value_for_mask(0o7777) == get_value_for_mask(0o0770) + else: + assert get_value_for_mask(0o7777) == get_value_for_mask(0o0700) -- cgit v1.2.1