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
Laurent S
erp5
Commits
c7989a40
Commit
c7989a40
authored
Dec 14, 2012
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
56358d3f
f35be15d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
13 deletions
+42
-13
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+24
-4
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 @
c7989a40
...
@@ -105,13 +105,20 @@ class ERP5TestNode(TestCase):
...
@@ -105,13 +105,20 @@ class ERP5TestNode(TestCase):
for
i
,
repository_path
in
enumerate
(
repository_list
):
for
i
,
repository_path
in
enumerate
(
repository_list
):
call
=
self
.
getCaller
(
cwd
=
repository_path
)
call
=
self
.
getCaller
(
cwd
=
repository_path
)
call
(
"git init"
.
split
())
call
(
"git init"
.
split
())
git_config
=
open
(
os
.
path
.
join
(
repository_path
,
'.git'
,
'config'
),
'a'
)
git_config
.
write
(
"""
[user]
name = a b
email = a@b.c
"""
)
git_config
.
close
()
call
(
"touch first_file"
.
split
())
call
(
"touch first_file"
.
split
())
call
(
"git add first_file"
.
split
())
call
(
"git add first_file"
.
split
())
call
(
"git commit -v -m first_commit"
.
split
()
+
[
'--author="a b <a@b.c>"'
]
)
call
(
"git commit -v -m first_commit"
.
split
())
my_file
=
open
(
os
.
path
.
join
(
repository_path
,
'first_file'
),
'w'
)
my_file
=
open
(
os
.
path
.
join
(
repository_path
,
'first_file'
),
'w'
)
my_file
.
write
(
"initial_content%i"
%
i
)
my_file
.
write
(
"initial_content%i"
%
i
)
my_file
.
close
()
my_file
.
close
()
call
(
"git commit -av -m next_commit"
.
split
()
+
[
'--author="a b <a@b.c>"'
]
)
call
(
"git commit -av -m next_commit"
.
split
())
output
=
call
([
'git'
,
'log'
,
'--format=%H %s'
])
output
=
call
([
'git'
,
'log'
,
'--format=%H %s'
])
output_line_list
=
output
.
split
(
"
\
n
"
)
output_line_list
=
output
.
split
(
"
\
n
"
)
self
.
assertEquals
(
3
,
len
(
output_line_list
))
self
.
assertEquals
(
3
,
len
(
output_line_list
))
...
@@ -211,7 +218,7 @@ branch = foo
...
@@ -211,7 +218,7 @@ branch = foo
my_file
.
write
(
"next_content"
)
my_file
.
write
(
"next_content"
)
my_file
.
close
()
my_file
.
close
()
call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository1
)
call
=
self
.
getCaller
(
cwd
=
self
.
remote_repository1
)
call
(
"git commit -av -m new_commit"
.
split
()
+
[
'--author="a b <a@b.c>"'
]
)
call
(
"git commit -av -m new_commit"
.
split
())
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
rev_list
=
test_node
.
getAndUpdateFullRevisionList
(
node_test_suite
)
self
.
assertTrue
(
rev_list
[
0
].
startswith
(
'rep0=2-'
))
self
.
assertTrue
(
rev_list
[
0
].
startswith
(
'rep0=2-'
))
self
.
assertTrue
(
rev_list
[
1
].
startswith
(
'rep1=3-'
))
self
.
assertTrue
(
rev_list
[
1
].
startswith
(
'rep1=3-'
))
...
@@ -310,7 +317,7 @@ branch = foo
...
@@ -310,7 +317,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 +464,16 @@ branch = foo
...
@@ -457,3 +464,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 @
c7989a40
...
@@ -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 @
c7989a40
...
@@ -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 @
c7989a40
...
@@ -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