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
Alexander Emmerich
erp5
Commits
d59b20f7
Commit
d59b20f7
authored
Jun 06, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement new way to perform ScalabilityTestNode in testERP5TestNode.py
parent
06055895
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
184 additions
and
121 deletions
+184
-121
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+91
-65
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+27
-6
erp5/util/testnode/SlapOSControler.py
erp5/util/testnode/SlapOSControler.py
+50
-47
erp5/util/testnode/testnode.py
erp5/util/testnode/testnode.py
+16
-3
No files found.
erp5/tests/testERP5TestNode.py
View file @
d59b20f7
This diff is collapsed.
Click to expand it.
erp5/util/testnode/ScalabilityTestRunner.py
View file @
d59b20f7
...
@@ -55,12 +55,34 @@ class ScalabilityTestRunner():
...
@@ -55,12 +55,34 @@ class ScalabilityTestRunner():
self
.
master_nodes
=
[]
# doesn't change during all the test
self
.
master_nodes
=
[]
# doesn't change during all the test
self
.
slave_nodes
=
[]
# doesn't change during all the test
self
.
slave_nodes
=
[]
# doesn't change during all the test
# remaining_software_installation_grid contains at the begining
# all the softwares needed for this runner
# The grid looks like :
# { "COMP-1234" : ['http://soft1.cfg', 'https:///ipv6:00/soft2.cfg'],
# "COMP-4" : ['http://soft1.cfg', 'https:///ipv6:00/soft3.cfg'],
# "COMP-834" : ['http://soft4.cfg'],
# "COMP-90" : ['http://soft1.cfg', 'https:///ipv6:00/soft2.cfg'],
# }
# A thread is in charge of checking (by communication with slapOS Master)
# if softwares are correctly installed. If a software is correctly installed,
# the thread remove the software_url from the grid.
# The thread never stop his work until he is not killed.
# In an other hand, the runner (here) loop while the grid is not empty.
# When the grid is empty, it means that all softwares are installed, so
# the runner kills the thread and goes to the next procedure step.
def
_prepareSlapOS
(
*
args
,
**
kw
):
# So, it also means that cluster_configuration, cluster_constraint
# and the list of availables/involved nodes (=> software repartition)
# have to be known to fill the grid.
self
.
remaining_software_installation_grid
=
{}
def
_prepareSlapOS
(
self
,
software_path
,
computer_guid
,
create_partition
=
0
):
# create_partition is kept for compatibility
"""
"""
A proxy to supply : Install software a software on a specific node
A proxy to supply : Install software a software on a specific node
"""
"""
self
.
slapos_controler
.
supply
(
*
args
,
**
kw
)
self
.
slapos_controler
.
supply
(
software_path
,
computer_guid
,
create_partition
)
# TODO : do something with slapOS Master to check if it's ok
# TODO : do something with slapOS Master to check if it's ok
# put it here ?
# put it here ?
# TODO : change the line below
# TODO : change the line below
...
@@ -78,16 +100,15 @@ class ScalabilityTestRunner():
...
@@ -78,16 +100,15 @@ class ScalabilityTestRunner():
# TODO : change the line below
# TODO : change the line below
return
{
'status_code'
:
0
}
return
{
'status_code'
:
0
}
def
_extractSoftwarePathList
(
self
,
node_test_suite
):
# TODO : write code
return
[]
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
"""
"""
Install all testsuite's softwares (on worker_nodes)
Install all testsuite's softwares (on worker_nodes)
"""
"""
# In fact we just need to extract (by knowing the ipv6)
# In fact we just need to extract (by knowing the ipv6)
# softwares ipv6-url ( created during constructProfile(...) )
# softwares ipv6-url ( created during constructProfile(...) )
software_path_list
=
_extractSoftwarePathList
(
software_path_list
)
#software_path_list = _extractSoftwarePathList(software_path_list)
# TODO : extract software paths (ipv6+local suite path+password?) from node_test_suite
software_path_list
=
[]
for
software_path
in
software_path_list
:
for
software_path
in
software_path_list
:
for
worker_node
in
self
.
worker_nodes
:
for
worker_node
in
self
.
worker_nodes
:
self
.
_prepareSlapOS
(
software_path
,
worker_node
[
'computer_id'
])
self
.
_prepareSlapOS
(
software_path
,
worker_node
[
'computer_id'
])
...
...
erp5/util/testnode/SlapOSControler.py
View file @
d59b20f7
...
@@ -58,25 +58,21 @@ def createFile(path, mode, content):
...
@@ -58,25 +58,21 @@ def createFile(path, mode, content):
# TODO : merge two controler in one (with different method name ?)
class
SlapOSControler
(
object
):
class
SlapOSControlerCluster
(
object
):
def
__init__
(
self
,
working_directory
,
config
,
log
,
configuration_path_file
):
GenericSlapOSControler
.
__init__
(
self
,
working_directory
,
config
,
log
)
self
.
configuration_path_file
=
configuration_path_file
def
initializeSlapOSControler
(
software_path_list
=
None
,
computer_guid
=
None
):
def
__init__
(
self
,
working_directory
,
config
,
log
):
"""
self
.
config
=
config
Supply several softwares from a list on a node
self
.
software_root
=
os
.
path
.
join
(
working_directory
,
'soft'
)
Ex :
self
.
instance_root
=
os
.
path
.
join
(
working_directory
,
'inst'
)
my_controler.initializeSlapOSControler(['kvm.cfg', 'ok.cfg'], 'COMP-726')
self
.
slapos_config
=
os
.
path
.
join
(
working_directory
,
'slapos.cfg'
)
"""
self
.
log
=
log
for
software_path
in
software_path_list
:
self
.
proxy_database
=
os
.
path
.
join
(
working_directory
,
'proxy.db'
)
self
.
supply
(
software_path
,
computer_guid
)
#self.configuration_path_file = self.config['configuration_path_file']
self
.
configuration_path_file
=
""
def
supply
(
self
,
software_url
,
computer_id
):
def
supply
(
self
,
software_url
,
computer_id
,
remove
=
False
):
"""
"""
Request the installation of a software release on a specific node
Ex :
Ex :
my_controler.supply('kvm.cfg', 'COMP-726')
my_controler.supply('kvm.cfg', 'COMP-726')
"""
"""
...
@@ -90,12 +86,24 @@ class SlapOSControlerCluster(object):
...
@@ -90,12 +86,24 @@ class SlapOSControlerCluster(object):
if
os
.
path
.
exists
(
configuration_file_path
):
if
os
.
path
.
exists
(
configuration_file_path
):
args
=
parser
.
parse_args
([
self
.
configuration_file_path
,
software_url
,
computer_id
])
args
=
parser
.
parse_args
([
self
.
configuration_file_path
,
software_url
,
computer_id
])
config
=
client
.
Config
(
args
,
args
.
configuration_file
)
config
=
client
.
Config
(
args
,
args
.
configuration_file
)
client
.
supply
(
args
.
software_url
,
args
.
node
,
client
.
init
(
config
))
try
:
client
.
supply
(
args
.
software_url
,
args
.
node
,
client
.
init
(
config
),
remove
=
remove
)
except
:
self
.
log
(
"SlapOSControler.supply,
\
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
raise
ValueError
(
"Unable to supply (or remove)"
)
else
:
else
:
raise
ValueError
(
"Configuration file not found."
)
raise
ValueError
(
"Configuration file not found."
)
def
destroy
(
self
,
software_url
,
computer_id
):
"""
Request Deletetion of a software release on a specific node
Ex :
my_controler.destroy('kvm.cfg', 'COMP-726')
"""
self
.
supply
(
self
,
software_url
,
computer_id
,
remove
=
True
)
def
_
request
(
self
,
reference
,
def
request
(
self
,
reference
,
software_url
,
software_type
,
software_configuration
,
computer_guid
=
None
):
software_url
,
software_type
,
software_configuration
,
computer_guid
=
None
):
"""
"""
configuration_file_path (slapos acount)
configuration_file_path (slapos acount)
...
@@ -112,16 +120,16 @@ class SlapOSControlerCluster(object):
...
@@ -112,16 +120,16 @@ class SlapOSControlerCluster(object):
# TODO : remove return
# TODO : remove return
return
return
self
.
log
(
'SlapOSControler : _request'
)
self
.
log
(
'SlapOSControler : _request'
)
filter_kw
=
None
filter_kw
=
None
if
computer_guid
!=
None
:
if
computer_guid
!=
None
:
filter_kw
=
{
"computer_guid"
:
computer_guid
}
filter_kw
=
{
"computer_guid"
:
computer_guid
}
if
os
.
path
.
exists
(
configuration_file_path
):
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"configuration_file"
)
parser
.
add_argument
(
"configuration_file"
)
args
=
parser
.
parse_args
([
self
.
configuration_file_path
])
args
=
parser
.
parse_args
([
self
.
configuration_file_path
])
config
=
client
.
Config
(
args
,
args
.
configuration_file
)
config
=
client
.
Config
(
args
,
args
.
configuration_file
)
local
=
client
.
init
(
config
)
local
=
client
.
init
(
config
)
try
:
partition
=
local
[
'slap'
].
registerOpenOrder
().
request
(
partition
=
local
[
'slap'
].
registerOpenOrder
().
request
(
software_release
=
software_url
,
software_release
=
software_url
,
partition_reference
=
reference
,
partition_reference
=
reference
,
...
@@ -130,18 +138,13 @@ class SlapOSControlerCluster(object):
...
@@ -130,18 +138,13 @@ class SlapOSControlerCluster(object):
filter_kw
=
filter_kw
)
filter_kw
=
filter_kw
)
# print "Instance requested.\nState is : %s." % partition.getState()
# print "Instance requested.\nState is : %s." % partition.getState()
# Is it possible to have the true state of the instance with getState() ?
# Is it possible to have the true state of the instance with getState() ?
# Do a return partition ?
except
:
self
.
log
(
"SlapOSControler.request,
\
class
SlapOSControler
(
object
):
exception in registerOpenOrder"
,
exc_info
=
sys
.
exc_info
())
raise
ValueError
(
"Unable to request"
)
def
__init__
(
self
,
working_directory
,
config
,
log
):
else
:
self
.
config
=
config
raise
ValueError
(
"Configuration file not found."
)
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
.
log
=
log
self
.
proxy_database
=
os
.
path
.
join
(
working_directory
,
'proxy.db'
)
def
_resetSoftware
(
self
):
def
_resetSoftware
(
self
):
self
.
log
(
'SlapOSControler : GOING TO RESET ALL SOFTWARE : %r'
%
self
.
log
(
'SlapOSControler : GOING TO RESET ALL SOFTWARE : %r'
%
...
...
erp5/util/testnode/testnode.py
View file @
d59b20f7
...
@@ -304,7 +304,7 @@ branch = %(branch)s
...
@@ -304,7 +304,7 @@ branch = %(branch)s
self
.
_cleanupLog
()
self
.
_cleanupLog
()
self
.
_cleanupTemporaryFiles
()
self
.
_cleanupTemporaryFiles
()
def
run
(
self
):
def
run
(
self
,
my_type_test
=
None
):
## BLOCK OK
## BLOCK OK
log
=
self
.
log
log
=
self
.
log
...
@@ -339,10 +339,23 @@ branch = %(branch)s
...
@@ -339,10 +339,23 @@ branch = %(branch)s
# Select the good runner
# Select the good runner
if
True
:
if
my_type_test
==
None
:
# Default way to determine if it is a slability or unit test
# Here parse/get information to
# if XXX : runner = UnitTe...
# elif YYY : runner = Scal...
# else : Raise ...
# But for the moment :
runner
=
UnitTestRunner
(
self
)
runner
=
UnitTestRunner
(
self
)
else
:
# Used in testERP5TestNode
if
my_type_test
==
'UnitTest'
:
runner
=
UnitTestRunner
(
self
)
elif
my_type_test
==
'ScalabilityTest'
:
runner
=
ScalabilityTestRunner
(
self
)
runner
=
ScalabilityTestRunner
(
self
)
else
:
raise
NotImplementedError
runner
.
prepareSlapOSForTestNode
(
test_node_slapos
)
runner
.
prepareSlapOSForTestNode
(
test_node_slapos
)
#Clean-up test suites
#Clean-up test suites
...
...
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