You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:58:52 UTC

[buildstream] 16/26: tests: avoid testing utimes along with umask

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch traveltissues/mr4
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c3c0b049d5175857343a1309e9223708f35d3d8d
Author: Darius Makovsky <tr...@protonmail.com>
AuthorDate: Mon Dec 30 08:47:19 2019 +0000

    tests: avoid testing utimes along with umask
    
    Avoids testing for utimes when testing for umask. These tests are known to
    be flaky and are overly specific in that they implicitly test more than
    just umask.
---
 src/buildstream/testing/_sourcetests/source_determinism.py | 9 ++++-----
 tests/integration/source-determinism.py                    | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/buildstream/testing/_sourcetests/source_determinism.py b/src/buildstream/testing/_sourcetests/source_determinism.py
index ed00c71..c44f0fa 100644
--- a/src/buildstream/testing/_sourcetests/source_determinism.py
+++ b/src/buildstream/testing/_sourcetests/source_determinism.py
@@ -50,10 +50,6 @@ def create_test_directory(*path, mode=0o644):
 @pytest.mark.integration
 @pytest.mark.datafiles(DATA_DIR)
 @pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
-@pytest.mark.skipif(
-    HAVE_SANDBOX == "buildbox-run" and CASD_SEPARATE_USER,
-    reason="Flaky due to timestamps: https://gitlab.com/BuildStream/buildstream/issues/1218",
-)
 def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
     project = str(datafiles)
     element_name = "list.bst"
@@ -92,6 +88,7 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
         old_umask = os.umask(umask)
 
         try:
+            test_values = []
             result = cli.run(project=project, args=["build", element_name])
             result.assert_success()
 
@@ -99,7 +96,9 @@ def test_deterministic_source_umask(cli, tmpdir, datafiles, kind):
             result.assert_success()
 
             with open(os.path.join(checkoutdir, "ls-l"), "r") as f:
-                return f.read()
+                for line in f.readlines():
+                    test_values.append(line.split()[0] + " " + line.split()[-1])
+                return test_values
         finally:
             os.umask(old_umask)
             cli.remove_artifact_from_cache(project, element_name)
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py
index 3555881..a69e55a 100644
--- a/tests/integration/source-determinism.py
+++ b/tests/integration/source-determinism.py
@@ -29,10 +29,6 @@ def create_test_directory(*path, mode=0o644):
 @pytest.mark.integration
 @pytest.mark.datafiles(DATA_DIR)
 @pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox")
-@pytest.mark.skipif(
-    HAVE_SANDBOX == "buildbox-run" and CASD_SEPARATE_USER,
-    reason="Flaky due to timestamps: https://gitlab.com/BuildStream/buildstream/issues/1218",
-)
 def test_deterministic_source_local(cli, tmpdir, datafiles):
     """Only user rights should be considered for local source.
     """
@@ -62,6 +58,7 @@ def test_deterministic_source_local(cli, tmpdir, datafiles):
         create_test_directory(sourcedir, "dir-c", mode=0o2755 & mask)
         create_test_directory(sourcedir, "dir-d", mode=0o1755 & mask)
         try:
+            test_values = []
             result = cli.run(project=project, args=["build", element_name])
             result.assert_success()
 
@@ -69,7 +66,9 @@ def test_deterministic_source_local(cli, tmpdir, datafiles):
             result.assert_success()
 
             with open(os.path.join(checkoutdir, "ls-l"), "r") as f:
-                return f.read()
+                for line in f.readlines():
+                    test_values.append(line.split()[0] + " " + line.split()[-1])
+                return test_values
         finally:
             cli.remove_artifact_from_cache(project, element_name)