Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
143
Merge Requests
143
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
14da52c3
Commit
14da52c3
authored
Dec 14, 2012
by
Sebastien Robin
Committed by
Sebastien Robin
Dec 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5-util/testnode : add test to check deletion of software
parent
4f02cf8c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
10 deletions
+32
-10
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+14
-1
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+13
-7
erp5/util/testnode/__init__.py
erp5/util/testnode/__init__.py
+3
-0
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+2
-2
No files found.
erp5/tests/testERP5TestNode.py
View file @
14da52c3
...
@@ -310,7 +310,7 @@ branch = foo
...
@@ -310,7 +310,7 @@ branch = foo
return
[]
return
[]
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
test_node
.
slapos_controler
=
SlapOSControler
(
self
.
working_directory
,
test_node
.
slapos_controler
=
SlapOSControler
(
self
.
working_directory
,
test_node
.
config
)
test_node
.
config
,
self
.
log
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
node_test_suite
.
revision
=
'dummy'
node_test_suite
.
revision
=
'dummy'
...
@@ -457,3 +457,16 @@ branch = foo
...
@@ -457,3 +457,16 @@ branch = foo
process_manager
=
ProcessManager
(
log
=
self
.
log
,
max_timeout
=
1
)
process_manager
=
ProcessManager
(
log
=
self
.
log
,
max_timeout
=
1
)
_checkCorrectStatus
(
0
,
*
[
'sleep'
,
'0'
])
_checkCorrectStatus
(
0
,
*
[
'sleep'
,
'0'
])
_checkCorrectStatus
(
-
15
,
*
[
'sleep'
,
'2'
])
_checkCorrectStatus
(
-
15
,
*
[
'sleep'
,
'2'
])
def
test_13_SlaposControlerResetSoftware
(
self
):
test_node
=
self
.
getTestNode
()
controler
=
SlapOSControler
(
self
.
working_directory
,
test_node
.
config
,
self
.
log
)
os
.
mkdir
(
controler
.
software_root
)
file_name
=
'AC_Ra
\
xc3
\
xad
zertic
\
xc3
\
xa1
ma'
non_ascii_file
=
open
(
os
.
path
.
join
(
controler
.
software_root
,
file_name
),
'w'
)
non_ascii_file
.
close
()
self
.
assertEquals
([
file_name
],
os
.
listdir
(
controler
.
software_root
))
controler
.
software_root
=
unicode
(
controler
.
software_root
)
controler
.
_resetSoftware
()
self
.
assertEquals
([],
os
.
listdir
(
controler
.
software_root
))
erp5/util/testnode/SlapOSControler.py
View file @
14da52c3
...
@@ -42,14 +42,24 @@ def createFolder(folder):
...
@@ -42,14 +42,24 @@ def createFolder(folder):
class
SlapOSControler
(
object
):
class
SlapOSControler
(
object
):
def
__init__
(
self
,
working_directory
,
config
):
def
__init__
(
self
,
working_directory
,
config
,
log
):
self
.
config
=
config
self
.
config
=
config
self
.
software_root
=
os
.
path
.
join
(
working_directory
,
'soft'
)
self
.
software_root
=
os
.
path
.
join
(
working_directory
,
'soft'
)
self
.
instance_root
=
os
.
path
.
join
(
working_directory
,
'inst'
)
self
.
instance_root
=
os
.
path
.
join
(
working_directory
,
'inst'
)
self
.
slapos_config
=
os
.
path
.
join
(
working_directory
,
'slapos.cfg'
)
self
.
slapos_config
=
os
.
path
.
join
(
working_directory
,
'slapos.cfg'
)
self
.
proxy_database
=
os
.
path
.
join
(
working_directory
,
'proxy.db'
)
self
.
proxy_database
=
os
.
path
.
join
(
working_directory
,
'proxy.db'
)
self
.
log
=
log
def
_resetSoftware
(
self
):
self
.
log
(
'SlapOSControler : GOING TO RESET ALL SOFTWARE : %r'
%
(
self
.
software_root
,))
if
os
.
path
.
exists
(
self
.
software_root
):
shutil
.
rmtree
(
self
.
software_root
)
os
.
mkdir
(
self
.
software_root
)
os
.
chmod
(
self
.
software_root
,
0750
)
def
initializeSlapOSControler
(
self
,
log
,
slapproxy_log
=
None
,
process_manager
=
None
,
def
initializeSlapOSControler
(
self
,
slapproxy_log
=
None
,
process_manager
=
None
,
reset_software
=
False
,
software_path_list
=
None
):
reset_software
=
False
,
software_path_list
=
None
):
self
.
log
=
log
self
.
log
=
log
self
.
process_manager
=
process_manager
self
.
process_manager
=
process_manager
...
@@ -91,11 +101,7 @@ class SlapOSControler(object):
...
@@ -91,11 +101,7 @@ class SlapOSControler(object):
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
# Reset all previously generated software if needed
# Reset all previously generated software if needed
if
reset_software
:
if
reset_software
:
log
(
'SlapOSControler : GOING TO RESET ALL SOFTWARE : %r'
%
(
self
.
software_root
,))
self
.
_resetSoftware
()
if
os
.
path
.
exists
(
self
.
software_root
):
shutil
.
rmtree
(
self
.
software_root
)
os
.
mkdir
(
self
.
software_root
)
os
.
chmod
(
self
.
software_root
,
0750
)
instance_root
=
self
.
instance_root
instance_root
=
self
.
instance_root
if
os
.
path
.
exists
(
instance_root
):
if
os
.
path
.
exists
(
instance_root
):
# delete old paritions which may exists in order to not get its data
# delete old paritions which may exists in order to not get its data
...
...
erp5/util/testnode/__init__.py
View file @
14da52c3
...
@@ -81,6 +81,9 @@ def main(*args):
...
@@ -81,6 +81,9 @@ def main(*args):
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
'log_directory'
,
'run_directory'
):
'log_directory'
,
'run_directory'
):
d
=
CONFIG
[
key
]
d
=
CONFIG
[
key
]
if
isinstance
(
d
,
unicode
):
d
=
d
.
encode
(
'utf8'
)
CONFIG
[
key
]
=
d
if
not
os
.
path
.
isdir
(
d
):
if
not
os
.
path
.
isdir
(
d
):
raise
ValueError
(
'Directory %r does not exists.'
%
d
)
raise
ValueError
(
'Directory %r does not exists.'
%
d
)
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
...
...
erp5/util/testnode/testnode.py
View file @
14da52c3
...
@@ -230,8 +230,8 @@ branch = %(branch)s
...
@@ -230,8 +230,8 @@ branch = %(branch)s
self
.
log
(
'testnode, retry_software_count : %r'
%
\
self
.
log
(
'testnode, retry_software_count : %r'
%
\
slapos_instance
.
retry_software_count
)
slapos_instance
.
retry_software_count
)
self
.
slapos_controler
=
SlapOSControler
.
SlapOSControler
(
self
.
slapos_controler
=
SlapOSControler
.
SlapOSControler
(
working_directory
,
self
.
config
)
working_directory
,
self
.
config
,
self
.
log
)
self
.
slapos_controler
.
initializeSlapOSControler
(
log
=
self
.
log
,
slapproxy_log
=
slapproxy_log
,
self
.
slapos_controler
.
initializeSlapOSControler
(
slapproxy_log
=
slapproxy_log
,
process_manager
=
self
.
process_manager
,
reset_software
=
reset_software
,
process_manager
=
self
.
process_manager
,
reset_software
=
reset_software
,
software_path_list
=
software_path_list
)
software_path_list
=
software_path_list
)
self
.
process_manager
.
supervisord_pid_file
=
os
.
path
.
join
(
\
self
.
process_manager
.
supervisord_pid_file
=
os
.
path
.
join
(
\
...
...
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