From b3fe30840e96e7fa77de047fae2488d703a49d89 Mon Sep 17 00:00:00 2001 From: Tom Clegg Date: Fri, 24 Mar 2017 15:59:26 -0400 Subject: [PATCH] 11209: Add tests for --unmount and --replace flags. --- services/fuse/tests/test_unmount.py | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 services/fuse/tests/test_unmount.py diff --git a/services/fuse/tests/test_unmount.py b/services/fuse/tests/test_unmount.py new file mode 100644 index 0000000000..9e2ebd7128 --- /dev/null +++ b/services/fuse/tests/test_unmount.py @@ -0,0 +1,44 @@ +import os +import subprocess + +from integration_test import IntegrationTest + +class UnmountTest(IntegrationTest): + def setUp(self): + super(UnmountTest, self).setUp() + self.tmp = self.mnt + self.to_delete = [] + + def tearDown(self): + for d in self.to_delete: + os.rmdir(d) + super(UnmountTest, self).tearDown() + + def test_replace(self): + subprocess.check_call( + ['arv-mount', '--subtype', 'test', '--replace', + self.mnt]) + subprocess.check_call( + ['arv-mount', '--subtype', 'test', '--replace', + '--unmount-timeout', '10', + self.mnt]) + subprocess.check_call( + ['arv-mount', '--subtype', 'test', '--replace', + '--unmount-timeout', '10', + self.mnt, + '--exec', 'true']) + for m in subprocess.check_output(['mount']).splitlines(): + self.assertNotIn(' '+self.mnt+' ', m) + + def test_unmount_children(self): + for d in ['foo', 'foo/bar', 'bar']: + mnt = self.tmp+'/'+d + os.mkdir(mnt) + self.to_delete.insert(0, mnt) + for d in ['bar', 'foo/bar']: + mnt = self.tmp+'/'+d + subprocess.check_call( + ['arv-mount', '--subtype', 'test', mnt]) + subprocess.check_call(['arv-mount', '--unmount', self.tmp+'/...']) + for m in subprocess.check_output(['mount']).splitlines(): + self.assertNotIn(' '+self.tmp+'/', m) -- 2.30.2