summaryrefslogtreecommitdiff
path: root/tests/sandboxes
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-02-10 07:24:09 +0100
committerJürg Billeter <j@bitron.ch>2020-02-10 07:24:09 +0100
commit7d8a23fd0a0dd6cdecef9e50a777c14644bc19fe (patch)
treeafb80a5b5fcd47367230e683d4c2d8f4fc112294 /tests/sandboxes
parent0591b0c8b038aa9f054b295748f3423384711d50 (diff)
downloadbuildstream-7d8a23fd0a0dd6cdecef9e50a777c14644bc19fe.tar.gz
sandbox: Remove unused _mounter.py
Diffstat (limited to 'tests/sandboxes')
-rw-r--r--tests/sandboxes/mounting/mount_simple.py52
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/sandboxes/mounting/mount_simple.py b/tests/sandboxes/mounting/mount_simple.py
deleted file mode 100644
index 0e78a5603..000000000
--- a/tests/sandboxes/mounting/mount_simple.py
+++ /dev/null
@@ -1,52 +0,0 @@
-import os
-import tempfile
-from contextlib import ExitStack
-
-import pytest
-
-from buildstream.sandbox._mounter import Mounter
-
-
-@pytest.mark.skipif(not os.geteuid() == 0, reason="requires root permissions")
-def test_bind_mount():
- with ExitStack() as stack:
- src = stack.enter_context(tempfile.TemporaryDirectory())
- target = stack.enter_context(tempfile.TemporaryDirectory())
-
- with open(os.path.join(src, "test"), "a") as test:
- test.write("Test")
-
- with Mounter.bind_mount(target, src) as dest:
- # Ensure we get the correct path back
- assert dest == target
-
- # Ensure we can access files from src from target
- with open(os.path.join(target, "test"), "r") as test:
- assert test.read() == "Test"
-
- # Ensure the files from src are gone from target
- with pytest.raises(FileNotFoundError):
- with open(os.path.join(target, "test"), "r"):
- # Actual contents don't matter
- pass
-
- # Ensure the files in src are still in src
- with open(os.path.join(src, "test"), "r") as test:
- assert test.read() == "Test"
-
-
-@pytest.mark.skipif(not os.geteuid() == 0, reason="requires root permissions")
-def test_mount_proc():
- with ExitStack() as stack:
- src = "/proc"
- target = stack.enter_context(tempfile.TemporaryDirectory())
-
- with Mounter.mount(target, src, mount_type="proc", ro=True) as dest:
- # Ensure we get the correct path back
- assert dest == target
-
- # Ensure /proc is actually mounted
- assert os.listdir(src) == os.listdir(target)
-
- # Ensure /proc is unmounted correctly
- assert os.listdir(target) == []