Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
erp5_rtl_support
Commits
120de5b7
Commit
120de5b7
authored
Feb 08, 2013
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish to make testnode logging in a file accessible by httpd
parent
6a4cbf5e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
20 deletions
+27
-20
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+5
-3
erp5/util/testnode/__init__.py
erp5/util/testnode/__init__.py
+3
-1
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+19
-16
No files found.
erp5/tests/testERP5TestNode.py
View file @
120de5b7
...
@@ -26,7 +26,7 @@ class ERP5TestNode(TestCase):
...
@@ -26,7 +26,7 @@ class ERP5TestNode(TestCase):
self
.
slapos_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'slapos'
)
self
.
slapos_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'slapos'
)
self
.
test_suite_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'test_suite'
)
self
.
test_suite_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'test_suite'
)
self
.
environment
=
os
.
path
.
join
(
self
.
_temp_dir
,
'environment'
)
self
.
environment
=
os
.
path
.
join
(
self
.
_temp_dir
,
'environment'
)
self
.
log_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'var/log'
)
self
.
log_directory
=
os
.
path
.
join
(
self
.
_temp_dir
,
'var/log
/testnode
'
)
self
.
log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'test.log'
)
self
.
log_file
=
os
.
path
.
join
(
self
.
log_directory
,
'test.log'
)
self
.
remote_repository0
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep0'
)
self
.
remote_repository0
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep0'
)
self
.
remote_repository1
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep1'
)
self
.
remote_repository1
=
os
.
path
.
join
(
self
.
_temp_dir
,
'rep1'
)
...
@@ -530,9 +530,11 @@ branch = foo
...
@@ -530,9 +530,11 @@ branch = foo
for
ref
,
suite
in
test_node
.
node_test_suite_dict
.
items
():
for
ref
,
suite
in
test_node
.
node_test_suite_dict
.
items
():
assert
(
suite
.
suite_log
is
not
None
)
assert
(
suite
.
suite_log
is
not
None
)
assert
(
isinstance
(
suite
.
suite_log
,
types
.
MethodType
))
assert
(
isinstance
(
suite
.
suite_log
,
types
.
MethodType
))
assert
(
'var/log/suite/%s'
%
suite
.
reference
in
suite
.
suite_log_path
)
self
.
assertTrue
(
'var/log/testnode/%s'
%
suite
.
reference
in
\
suite
.
suite_log_path
,
"Incorrect suite log path : %r"
%
suite
.
suite_log_path
)
assert
(
suite
.
suite_log_path
.
endswith
(
'suite.log'
))
assert
(
suite
.
suite_log_path
.
endswith
(
'suite.log'
))
m
=
re
.
match
(
'.*
\
/
(.*)
\
/suite.log'
,
suite
.
suite_log_path
)
m
=
re
.
match
(
'.*
\
-
(.*)
\
/suite.log'
,
suite
.
suite_log_path
)
rand_part
=
m
.
groups
()[
0
]
rand_part
=
m
.
groups
()[
0
]
assert
(
len
(
rand_part
)
==
32
)
assert
(
len
(
rand_part
)
==
32
)
assert
(
rand_part
not
in
rand_part_set
)
assert
(
rand_part
not
in
rand_part_set
)
...
...
erp5/util/testnode/__init__.py
View file @
120de5b7
...
@@ -75,7 +75,7 @@ def main(*args):
...
@@ -75,7 +75,7 @@ def main(*args):
'git_binary'
,
'zip_binary'
,
'node_quantity'
,
'test_node_title'
,
'git_binary'
,
'zip_binary'
,
'node_quantity'
,
'test_node_title'
,
'ipv4_address'
,
'ipv6_address'
,
'test_suite_master_url'
,
'ipv4_address'
,
'ipv6_address'
,
'test_suite_master_url'
,
'slapgrid_partition_binary'
,
'slapgrid_software_binary'
,
'slapgrid_partition_binary'
,
'slapgrid_software_binary'
,
'slapproxy_binary'
):
'slapproxy_binary'
,
'httpd_ip'
,
'httpd_port'
):
CONFIG
[
key
]
=
config
.
get
(
'testnode'
,
key
)
CONFIG
[
key
]
=
config
.
get
(
'testnode'
,
key
)
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
for
key
in
(
'slapos_directory'
,
'working_directory'
,
'test_suite_directory'
,
...
@@ -85,6 +85,8 @@ def main(*args):
...
@@ -85,6 +85,8 @@ def main(*args):
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'
],
CONFIG
[
'proxy_port'
])
CONFIG
[
'proxy_port'
])
CONFIG
[
'httpd_url'
]
=
'https://[%s]:%s'
%
(
CONFIG
[
'httpd_ip'
],
CONFIG
[
'httpd_port'
])
# generate vcs_repository_list
# generate vcs_repository_list
if
'bot_environment'
in
config
.
sections
():
if
'bot_environment'
in
config
.
sections
():
...
...
erp5/util/testnode/testnode.py
View file @
120de5b7
...
@@ -110,20 +110,17 @@ class NodeTestSuite(SlapOSInstance):
...
@@ -110,20 +110,17 @@ class NodeTestSuite(SlapOSInstance):
vcs_repository
[
'repository_path'
]
=
repository_path
vcs_repository
[
'repository_path'
]
=
repository_path
def
createSuiteLog
(
self
):
def
createSuiteLog
(
self
):
# /srv/slapgrid/slappartXX/srv/var/log/suite/az/mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
# /srv/slapgrid/slappartXX/srv/var/log/testnode/az-mlksjfmlk234Sljssdflkj23KSdfslj/suite.log
if
getattr
(
self
,
"log_directory"
,
None
)
is
not
None
:
if
getattr
(
self
,
"suite_log_path"
,
None
)
is
None
:
alphabets
=
string
.
digits
+
string
.
letters
alphabets
=
string
.
digits
+
string
.
letters
rand_part
=
''
.
join
(
random
.
choice
(
alphabets
)
for
i
in
xrange
(
32
))
rand_part
=
''
.
join
(
random
.
choice
(
alphabets
)
for
i
in
xrange
(
32
))
random_suite_folder_id
=
'%s-%s'
%
(
self
.
reference
,
rand_part
)
suite_log_directory
=
os
.
path
.
join
(
self
.
log_directory
,
suite_log_directory
=
os
.
path
.
join
(
self
.
log_directory
,
'suite'
,
random_suite_folder_id
)
self
.
reference
,
rand_part
)
SlapOSControler
.
createFolders
(
suite_log_directory
)
SlapOSControler
.
createFolders
(
suite_log_directory
)
self
.
suite_log_path
=
os
.
path
.
join
(
suite_log_directory
,
self
.
suite_log_path
=
os
.
path
.
join
(
suite_log_directory
,
'suite.log'
)
'suite.log'
)
self
.
_initializeSuiteLog
()
self
.
_initializeSuiteLog
()
return
self
.
getSuiteLogPath
()
return
self
.
getSuiteLogPath
()
,
random_suite_folder_id
def
getSuiteLogPath
(
self
):
def
getSuiteLogPath
(
self
):
return
getattr
(
self
,
"suite_log_path"
,
None
)
return
getattr
(
self
,
"suite_log_path"
,
None
)
...
@@ -145,6 +142,7 @@ class NodeTestSuite(SlapOSInstance):
...
@@ -145,6 +142,7 @@ class NodeTestSuite(SlapOSInstance):
class
TestNode
(
object
):
class
TestNode
(
object
):
def
__init__
(
self
,
log
,
config
):
def
__init__
(
self
,
log
,
config
):
self
.
testnode_log
=
log
self
.
log
=
log
self
.
log
=
log
self
.
config
=
config
or
{}
self
.
config
=
config
or
{}
self
.
process_manager
=
ProcessManager
(
log
)
self
.
process_manager
=
ProcessManager
(
log
)
...
@@ -247,11 +245,15 @@ branch = %(branch)s
...
@@ -247,11 +245,15 @@ branch = %(branch)s
Create a log dedicated for the test suite,
Create a log dedicated for the test suite,
and register the url to master node.
and register the url to master node.
"""
"""
log_file_name
=
node_test_suite
.
createSuiteLog
()
log_file_name
,
folder_id
=
node_test_suite
.
createSuiteLog
()
if
log_file_name
is
None
and
config
.
get
(
'log_file'
):
if
log_file_name
is
None
and
config
.
get
(
'log_file'
):
log_file_name
=
config
[
'log_file'
]
log_file_name
=
config
[
'log_file'
]
# TODO make the path into url
# TODO make the path into url
test_result
.
reportStatus
(
'registerSuiteLog'
,
log_file_name
,
''
)
test_result
.
reportStatus
(
'LOG url'
,
"%s/%s"
%
(
self
.
config
.
get
(
'httpd_url'
),
folder_id
),
''
)
self
.
log
(
"going to switch to log %r"
%
log_file_name
)
log
=
node_test_suite
.
getSuiteLog
()
self
.
process_manager
.
log
=
self
.
log
=
log
return
log_file_name
return
log_file_name
def
checkRevision
(
self
,
test_result
,
node_test_suite
):
def
checkRevision
(
self
,
test_result
,
node_test_suite
):
...
@@ -393,6 +395,7 @@ branch = %(branch)s
...
@@ -393,6 +395,7 @@ branch = %(branch)s
try
:
try
:
while
True
:
while
True
:
try
:
try
:
self
.
log
=
self
.
process_manager
.
log
=
self
.
testnode_log
self
.
cleanUp
(
None
)
self
.
cleanUp
(
None
)
remote_test_result_needs_cleanup
=
False
remote_test_result_needs_cleanup
=
False
begin
=
time
.
time
()
begin
=
time
.
time
()
...
...
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