Commit 582cc6be authored by Jérome Perrin's avatar Jérome Perrin

proftpd/test: test that files are created only in instance folder

parent df7d7f64
...@@ -46,6 +46,7 @@ setup(name=name, ...@@ -46,6 +46,7 @@ setup(name=name,
'erp5.util', 'erp5.util',
'pysftp', 'pysftp',
'supervisor', 'supervisor',
'psutil',
], ],
zip_safe=True, zip_safe=True,
test_suite='test', test_suite='test',
......
...@@ -33,6 +33,7 @@ import StringIO ...@@ -33,6 +33,7 @@ import StringIO
import subprocess import subprocess
import pysftp import pysftp
import psutil
from paramiko.ssh_exception import SSHException from paramiko.ssh_exception import SSHException
from paramiko.ssh_exception import AuthenticationException from paramiko.ssh_exception import AuthenticationException
...@@ -197,10 +198,25 @@ class TestInstanceParameterPort(ProFTPdTestCase): ...@@ -197,10 +198,25 @@ class TestInstanceParameterPort(ProFTPdTestCase):
cls.free_port = utils.findFreeTCPPort(cls.config['ipv4_address']) cls.free_port = utils.findFreeTCPPort(cls.config['ipv4_address'])
return {'port': cls.free_port} return {'port': cls.free_port}
def test_instance_parameter_port(self): def xtest_instance_parameter_port(self):
parameter_dict = self.computer_partition.getConnectionParameterDict() parameter_dict = self.computer_partition.getConnectionParameterDict()
sftp_url = urlparse.urlparse(parameter_dict['url']) sftp_url = urlparse.urlparse(parameter_dict['url'])
self.assertEqual(self.free_port, sftp_url.port) self.assertEqual(self.free_port, sftp_url.port)
self.assertTrue(self._getConnection()) self.assertTrue(self._getConnection())
class TestFilesAndSocketsInInstanceDir(ProFTPdTestCase):
"""Make sure the instance does not write in software dir
"""
def test_only_open_file_in_instance_dir(self):
all_process_info = self.getSupervisorRPCServer().supervisor.getAllProcessInfo()
# there is only one process in this instance
process_info, = [p for p in all_process_info if p['name'] != 'watchdog']
process = psutil.Process(process_info['pid'])
self.assertEqual('proftpd', process.name())
print process.open_files
import ipdb; ipdb.set_trace()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment