Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
582cc6be
Commit
582cc6be
authored
May 22, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proftpd/test: test that files are created only in instance folder
parent
df7d7f64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
1 deletion
+18
-1
software/proftpd/test/setup.py
software/proftpd/test/setup.py
+1
-0
software/proftpd/test/test.py
software/proftpd/test/test.py
+17
-1
No files found.
software/proftpd/test/setup.py
View file @
582cc6be
...
@@ -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'
,
...
...
software/proftpd/test/test.py
View file @
582cc6be
...
@@ -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
x
test_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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment