From 54837759f36eddb80af22c8d73e103a948221dc7 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Mon, 19 Oct 2020 22:25:29 +0100 Subject: Tests: fixed unit.log print. --- test/test_java_isolation_rootfs.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'test/test_java_isolation_rootfs.py') diff --git a/test/test_java_isolation_rootfs.py b/test/test_java_isolation_rootfs.py index f0f04df1..4f9e9834 100644 --- a/test/test_java_isolation_rootfs.py +++ b/test/test_java_isolation_rootfs.py @@ -11,14 +11,12 @@ class TestJavaIsolationRootfs(TestApplicationJava): prerequisites = {'modules': {'java': 'all'}} def setup_method(self, is_su): - super().setup_method() - if not is_su: return - os.makedirs(self.temp_dir + '/jars') - os.makedirs(self.temp_dir + '/tmp') - os.chmod(self.temp_dir + '/tmp', 0o777) + os.makedirs(option.temp_dir + '/jars') + os.makedirs(option.temp_dir + '/tmp') + os.chmod(option.temp_dir + '/tmp', 0o777) try: process = subprocess.Popen( @@ -26,7 +24,7 @@ class TestJavaIsolationRootfs(TestApplicationJava): "mount", "--bind", option.current_dir + "/build", - self.temp_dir + "/jars", + option.temp_dir + "/jars", ], stderr=subprocess.STDOUT, ) @@ -42,7 +40,7 @@ class TestJavaIsolationRootfs(TestApplicationJava): try: process = subprocess.Popen( - ["umount", "--lazy", self.temp_dir + "/jars"], + ["umount", "--lazy", option.temp_dir + "/jars"], stderr=subprocess.STDOUT, ) @@ -51,15 +49,12 @@ class TestJavaIsolationRootfs(TestApplicationJava): except: pytest.fail('Cann\'t run mount process.') - # super teardown must happen after unmount to avoid deletion of /build - super().teardown_method() - - def test_java_isolation_rootfs_chroot_war(self, is_su): + def test_java_isolation_rootfs_chroot_war(self, is_su, temp_dir): if not is_su: pytest.skip('require root') isolation = { - 'rootfs': self.temp_dir, + 'rootfs': temp_dir, } self.load('empty_war', isolation=isolation) -- cgit From 567f0a7b3049f4532524ac35cb232cbeedb868bf Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Mon, 16 Nov 2020 20:37:01 +0300 Subject: Tests: fixing tests interrupt in terminal. KeyboardInterrupt re-raised. --- test/test_java_isolation_rootfs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'test/test_java_isolation_rootfs.py') diff --git a/test/test_java_isolation_rootfs.py b/test/test_java_isolation_rootfs.py index 4f9e9834..02d35a62 100644 --- a/test/test_java_isolation_rootfs.py +++ b/test/test_java_isolation_rootfs.py @@ -31,8 +31,11 @@ class TestJavaIsolationRootfs(TestApplicationJava): process.communicate() + except KeyboardInterrupt: + raise + except: - pytest.fail('Cann\'t run mount process.') + pytest.fail('Can\'t run mount process.') def teardown_method(self, is_su): if not is_su: @@ -46,8 +49,11 @@ class TestJavaIsolationRootfs(TestApplicationJava): process.communicate() + except KeyboardInterrupt: + raise + except: - pytest.fail('Cann\'t run mount process.') + pytest.fail('Can\'t run mount process.') def test_java_isolation_rootfs_chroot_war(self, is_su, temp_dir): if not is_su: -- cgit