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
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
Carlos Ramos Carreño
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
return
[]
test_node
=
self
.
getTestNode
()
test_node
.
slapos_controler
=
SlapOSControler
(
self
.
working_directory
,
test_node
.
config
)
test_node
.
config
,
self
.
log
)
node_test_suite
=
test_node
.
getNodeTestSuite
(
'foo'
)
self
.
updateNodeTestSuiteData
(
node_test_suite
)
node_test_suite
.
revision
=
'dummy'
...
...
@@ -457,3 +457,16 @@ branch = foo
process_manager
=
ProcessManager
(
log
=
self
.
log
,
max_timeout
=
1
)
_checkCorrectStatus
(
0
,
*
[
'sleep'
,
'0'
])
_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):
class
SlapOSControler
(
object
):
def
__init__
(
self
,
working_directory
,
config
):
def
__init__
(
self
,
working_directory
,
config
,
log
):
self
.
config
=
config
self
.
software_root
=
os
.
path
.
join
(
working_directory
,
'soft'
)
self
.
instance_root
=
os
.
path
.
join
(
working_directory
,
'inst'
)
self
.
slapos_config
=
os
.
path
.
join
(
working_directory
,
'slapos.cfg'
)
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
):
self
.
log
=
log
self
.
process_manager
=
process_manager
...
...
@@ -91,11 +101,7 @@ class SlapOSControler(object):
computer
=
slap
.
registerComputer
(
config
[
'computer_id'
])
# Reset all previously generated software if needed
if
reset_software
:
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
)
self
.
_resetSoftware
()
instance_root
=
self
.
instance_root
if
os
.
path
.
exists
(
instance_root
):
# 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):
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
'log_directory'
,
'run_directory'
):
d
=
CONFIG
[
key
]
if
isinstance
(
d
,
unicode
):
d
=
d
.
encode
(
'utf8'
)
CONFIG
[
key
]
=
d
if
not
os
.
path
.
isdir
(
d
):
raise
ValueError
(
'Directory %r does not exists.'
%
d
)
CONFIG
[
'master_url'
]
=
'http://%s:%s'
%
(
CONFIG
[
'proxy_host'
],
...
...
erp5/util/testnode/testnode.py
View file @
14da52c3
...
...
@@ -230,8 +230,8 @@ branch = %(branch)s
self
.
log
(
'testnode, retry_software_count : %r'
%
\
slapos_instance
.
retry_software_count
)
self
.
slapos_controler
=
SlapOSControler
.
SlapOSControler
(
working_directory
,
self
.
config
)
self
.
slapos_controler
.
initializeSlapOSControler
(
log
=
self
.
log
,
slapproxy_log
=
slapproxy_log
,
working_directory
,
self
.
config
,
self
.
log
)
self
.
slapos_controler
.
initializeSlapOSControler
(
slapproxy_log
=
slapproxy_log
,
process_manager
=
self
.
process_manager
,
reset_software
=
reset_software
,
software_path_list
=
software_path_list
)
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