Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos-mynij-dev
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mynij
slapos-mynij-dev
Commits
61b8e972
Commit
61b8e972
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
134c47de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
software/proftpd/test/setup.py
software/proftpd/test/setup.py
+1
-0
software/proftpd/test/test.py
software/proftpd/test/test.py
+27
-0
No files found.
software/proftpd/test/setup.py
View file @
61b8e972
...
...
@@ -46,6 +46,7 @@ setup(name=name,
'erp5.util'
,
'pysftp'
,
'supervisor'
,
'psutil'
,
],
zip_safe
=
True
,
test_suite
=
'test'
,
...
...
software/proftpd/test/test.py
View file @
61b8e972
...
...
@@ -33,6 +33,7 @@ import StringIO
import
subprocess
import
pysftp
import
psutil
from
paramiko.ssh_exception
import
SSHException
from
paramiko.ssh_exception
import
AuthenticationException
...
...
@@ -204,3 +205,29 @@ class TestInstanceParameterPort(ProFTPdTestCase):
self
.
assertTrue
(
self
.
_getConnection
())
class
TestFilesAndSocketsInInstanceDir
(
ProFTPdTestCase
):
"""Make sure the instance only have files and socket in software dir.
"""
def
setUp
(
self
):
"""sets `self.proftpdProcess` to `psutil.Process` for the running proftpd in the instance.
"""
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
())
# sanity check
self
.
proftpdProcess
=
process
def
test_only_write_file_in_instance_dir
(
self
):
self
.
assertEqual
(
[],
[
f
for
f
in
self
.
proftpdProcess
.
open_files
()
if
f
.
mode
!=
'r'
if
not
f
.
path
.
startswith
(
self
.
computer_partition_root_path
)])
def
test_only_unix_socket_in_instance_dir
(
self
):
self
.
assertEqual
(
[],
[
s
for
s
in
self
.
proftpdProcess
.
connections
(
'unix'
)
if
not
s
.
laddr
.
startswith
(
self
.
computer_partition_root_path
)])
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