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
90931139
Commit
90931139
authored
Apr 12, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
e0118fd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
software/proftpd/test/utils.py
software/proftpd/test/utils.py
+8
-5
No files found.
software/proftpd/test/utils.py
View file @
90931139
...
@@ -35,13 +35,12 @@ from erp5.util.testnode.SlapOSControler import SlapOSControler
...
@@ -35,13 +35,12 @@ from erp5.util.testnode.SlapOSControler import SlapOSControler
from
erp5.util.testnode.ProcessManager
import
ProcessManager
from
erp5.util.testnode.ProcessManager
import
ProcessManager
import
slapos
import
slapos
logger
=
logging
.
getLogger
(
__name__
)
def
findFreeTCPPort
(
ip
=
''
):
def
findFreeTCPPort
(
ip
=
''
):
"""Find a free TCP port to listen to.
"""Find a free TCP port to listen to.
inspired by https://stackoverflow.com/a/45690594
"""
"""
with
closing
(
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
))
as
s
:
family
=
socket
.
AF_INET6
if
':'
in
ip
else
socket
.
AF_INET
with
closing
(
socket
.
socket
(
family
,
socket
.
SOCK_STREAM
))
as
s
:
s
.
bind
((
ip
,
0
))
s
.
bind
((
ip
,
0
))
return
s
.
getsockname
()[
1
]
return
s
.
getsockname
()[
1
]
...
@@ -59,10 +58,13 @@ class SlapOSInstanceTestCase(unittest.TestCase):
...
@@ -59,10 +58,13 @@ class SlapOSInstanceTestCase(unittest.TestCase):
def
getInstanceParmeterDict
(
cls
):
def
getInstanceParmeterDict
(
cls
):
"""Return instance parameters
"""Return instance parameters
To be defined by subclasses if needed
To be defined by subclasses if they need to request instance with specific
parameters.
"""
"""
return
{}
return
{}
# TODO: software type ?
@
classmethod
@
classmethod
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
...
@@ -104,6 +106,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
...
@@ -104,6 +106,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
)
)
slapproxy_log
=
os
.
path
.
join
(
config
[
'log_directory'
],
'slapproxy.log'
)
slapproxy_log
=
os
.
path
.
join
(
config
[
'log_directory'
],
'slapproxy.log'
)
logger
=
logging
.
getLogger
(
__name__
)
logger
.
debug
(
'Configured slapproxy log to %r'
,
slapproxy_log
)
logger
.
debug
(
'Configured slapproxy log to %r'
,
slapproxy_log
)
software_url_list
=
cls
.
getSoftwareURLList
()
software_url_list
=
cls
.
getSoftwareURLList
()
...
@@ -151,6 +154,6 @@ class SlapOSInstanceTestCase(unittest.TestCase):
...
@@ -151,6 +154,6 @@ class SlapOSInstanceTestCase(unittest.TestCase):
@
classmethod
@
classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
print
"Teardown"
,
cls
# FIXME: if setUpClass fail, this is not called and leaks zombie processes
# FIXME: if setUpClass fail, this is not called and leaks zombie processes
cls
.
_process_manager
.
killPreviousRun
()
cls
.
_process_manager
.
killPreviousRun
()
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