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
1
Merge Requests
1
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
Boxiang Sun
erp5
Commits
1418705c
Commit
1418705c
authored
Oct 23, 2019
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow scalability runner to test existing instance and with existing frontend.
parent
bae290a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
43 deletions
+76
-43
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+74
-41
erp5/util/testnode/SlapOSMasterCommunicator.py
erp5/util/testnode/SlapOSMasterCommunicator.py
+2
-2
No files found.
erp5/util/testnode/ScalabilityTestRunner.py
View file @
1418705c
...
@@ -187,7 +187,8 @@ class ScalabilityTestRunner():
...
@@ -187,7 +187,8 @@ class ScalabilityTestRunner():
file
.
write
(
pickle
.
dumps
(
dictionary
))
file
.
write
(
pickle
.
dumps
(
dictionary
))
def
_createInstance
(
self
,
software_path
,
software_configuration
,
def
_createInstance
(
self
,
software_path
,
software_configuration
,
test_result
,
test_suite
,
frontend_software
,
frontend_instance_guid
=
None
):
test_result
,
test_suite
,
frontend_software
,
frontend_instance_guid
=
None
,
purge_previous_instance
=
True
):
"""
"""
Create scalability instance. If there is an old instance for this testsuite, it destroys it.
Create scalability instance. If there is an old instance for this testsuite, it destroys it.
"""
"""
...
@@ -195,7 +196,7 @@ class ScalabilityTestRunner():
...
@@ -195,7 +196,7 @@ class ScalabilityTestRunner():
slappart_directory
=
self
.
testnode
.
config
[
'srv_directory'
].
rsplit
(
"srv"
,
1
)[
0
]
slappart_directory
=
self
.
testnode
.
config
[
'srv_directory'
].
rsplit
(
"srv"
,
1
)[
0
]
instance_dict_file
=
slappart_directory
+
"var/"
+
INSTANCE_DICT
instance_dict_file
=
slappart_directory
+
"var/"
+
INSTANCE_DICT
instance_dict
=
self
.
getDictionaryFromFile
(
instance_dict_file
)
instance_dict
=
self
.
getDictionaryFromFile
(
instance_dict_file
)
if
test_suite
in
instance_dict
:
if
test_suite
in
instance_dict
and
purge_previous_instance
:
self
.
slapos_communicator
.
requestInstanceDestroy
(
instance_dict
[
test_suite
])
self
.
slapos_communicator
.
requestInstanceDestroy
(
instance_dict
[
test_suite
])
self
.
updateDictionaryFile
(
instance_dict_file
,
instance_dict
,
test_suite
,
self
.
instance_title
)
self
.
updateDictionaryFile
(
instance_dict_file
,
instance_dict
,
test_suite
,
self
.
instance_title
)
logger
.
info
(
"testnode, request : %s"
,
self
.
instance_title
)
logger
.
info
(
"testnode, request : %s"
,
self
.
instance_title
)
...
@@ -391,43 +392,67 @@ Require valid-user
...
@@ -391,43 +392,67 @@ Require valid-user
return
{
'status_code'
:
1
}
return
{
'status_code'
:
1
}
configuration_list
=
test_configuration
[
'configuration_list'
]
configuration_list
=
test_configuration
[
'configuration_list'
]
configuration
=
configuration_list
[
0
]
self
.
instance_name
=
configuration
.
get
(
'instance-name'
)
self
.
frontend_address
=
configuration
.
get
(
"frontend-address"
)
self
.
instance_software_release
=
configuration
.
get
(
'instance-software-release'
)
self
.
use_existing_setup
=
self
.
instance_name
is
not
None
and
self
.
frontend_address
is
not
None
node_test_suite
.
edit
(
configuration_list
=
configuration_list
)
node_test_suite
.
edit
(
configuration_list
=
configuration_list
)
self
.
launcher_nodes_computer_guid
=
test_configuration
[
'launcher_nodes_computer_guid'
]
self
.
launcher_nodes_computer_guid
=
test_configuration
[
'launcher_nodes_computer_guid'
]
self
.
instance_title
=
self
.
_generateInstanceTitle
(
node_test_suite
.
test_suite_title
)
if
self
.
instance_name
is
not
None
:
# use existing already setup instance
logger
.
info
(
"Overide instance name: %s"
%
self
.
instance_name
)
self
.
instance_title
=
self
.
instance_name
else
:
self
.
instance_title
=
self
.
_generateInstanceTitle
(
node_test_suite
.
test_suite_title
)
# allow to override the software release
if
self
.
instance_software_release
is
not
None
:
logger
.
info
(
"Overide instance software release: %s"
%
self
.
instance_software_release
)
self
.
reachable_profile
=
self
.
instance_software_release
else
:
# generate a dynamic release for current revisions
self
.
createSoftwareReachableProfilePath
(
node_test_suite
)
self
.
createSoftwareReachableProfilePath
(
node_test_suite
)
logger
.
info
(
"Software reachable profile path is: %s"
,
self
.
reachable_profile
)
logger
.
info
(
"Software reachable profile path is: %s"
,
self
.
reachable_profile
)
# Initialize SlapOS Master Communicator
# Initialize SlapOS Master Communicator
self
.
slapos_communicator
=
SlapOSMasterCommunicator
.
SlapOSTester
(
self
.
slapos_communicator
=
SlapOSMasterCommunicator
.
SlapOSTester
(
self
.
instance_title
,
self
.
instance_title
,
slap
,
slap
,
order
,
order
,
supply
,
supply
,
self
.
reachable_profile
,
self
.
reachable_profile
,
computer_guid
=
self
.
launcher_nodes_computer_guid
[
0
])
computer_guid
=
self
.
launcher_nodes_computer_guid
[
0
])
# Ask for SR installation
for
computer_guid
in
self
.
involved_nodes_computer_guid
:
if
not
self
.
use_existing_setup
:
self
.
_prepareSlapOS
(
self
.
reachable_profile
,
computer_guid
)
# Ask for SR installation
# From the line below we would not supply any more softwares
for
computer_guid
in
self
.
involved_nodes_computer_guid
:
self
.
authorize_supply
=
False
self
.
_prepareSlapOS
(
self
.
reachable_profile
,
computer_guid
)
# TODO : remove the line below wich simulate an answer from slapos master
# From the line below we would not supply any more softwares
self
.
_prepareDummySlapOSAnswer
()
self
.
authorize_supply
=
False
# Waiting until all softwares are installed
# TODO : remove the line below wich simulate an answer from slapos master
while
(
self
.
remainSoftwareToInstall
()
self
.
_prepareDummySlapOSAnswer
()
and
(
max_time
>
(
time
.
time
()
-
start_time
))):
# Waiting until all softwares are installed
logger
.
info
(
"Master testnode is waiting for the end of "
while
(
self
.
remainSoftwareToInstall
()
"all software installation (for %ss) PID=%s."
,
and
(
max_time
>
(
time
.
time
()
-
start_time
))):
int
(
time
.
time
()
-
start_time
),
os
.
getpid
())
logger
.
info
(
"Master testnode is waiting for the end of "
time
.
sleep
(
interval_time
)
"all software installation (for %ss) PID=%s."
,
# TODO : remove the line below wich simulate an answer from slapos master
int
(
time
.
time
()
-
start_time
),
os
.
getpid
())
self
.
_comeBackFromDummySlapOS
()
time
.
sleep
(
interval_time
)
if
self
.
remainSoftwareToInstall
()
:
# TODO : remove the line below wich simulate an answer from slapos master
# All softwares are not installed, however maxtime is elapsed, that's a failure.
self
.
_comeBackFromDummySlapOS
()
logger
.
error
(
"All softwares are not installed."
)
if
self
.
remainSoftwareToInstall
()
:
return
{
'status_code'
:
1
}
# All softwares are not installed, however maxtime is elapsed, that's a failure.
logger
.
error
(
"All softwares are not installed."
)
return
{
'status_code'
:
1
}
logger
.
debug
(
"All software installed."
)
# even if we re-use existing setup we need proper configuration applied
self
.
authorize_request
=
True
self
.
authorize_request
=
True
logger
.
debug
(
"All software installed."
)
# Launch instance
# Launch instance
try
:
try
:
self
.
_createInstance
(
self
.
reachable_profile
,
self
.
_createInstance
(
self
.
reachable_profile
,
...
@@ -435,7 +460,8 @@ Require valid-user
...
@@ -435,7 +460,8 @@ Require valid-user
node_test_suite
.
test_result
,
node_test_suite
.
test_result
,
node_test_suite
.
test_suite
,
node_test_suite
.
test_suite
,
self
.
frontend_software
,
self
.
frontend_software
,
self
.
frontend_instance_guid
)
self
.
frontend_instance_guid
,
purge_previous_instance
=
not
self
.
use_existing_setup
)
logger
.
debug
(
"Scalability instance requested."
)
logger
.
debug
(
"Scalability instance requested."
)
self
.
_waitInstanceCreation
(
self
.
instance_title
)
self
.
_waitInstanceCreation
(
self
.
instance_title
)
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -462,23 +488,29 @@ Require valid-user
...
@@ -462,23 +488,29 @@ Require valid-user
pass
pass
return
suite
,
repo_location
return
suite
,
repo_location
def
getInstanceInformation
(
self
,
suite
,
count
):
def
getInstanceInformation
(
self
,
suite
,
count
,
node_test_suite
=
None
):
logger
.
info
(
"Getting instance information:"
)
logger
.
info
(
"Getting instance information:"
)
instance_information_time
=
time
.
time
()
instance_information_time
=
time
.
time
()
instance_information
=
self
.
slapos_communicator
.
getInstanceUrlDict
()
instance_information
=
self
.
slapos_communicator
.
getInstanceUrlDict
()
while
(
time
.
time
()
-
instance_information_time
<
MAX_FRONTEND_TIME
):
while
(
time
.
time
()
-
instance_information_time
<
MAX_FRONTEND_TIME
):
logger
.
info
(
"getInstanceInformation=%s"
%
instance_information
)
# loop until frontend is instanciated
# loop until frontend is instanciated
if
instance_information
[
'frontend-url-list'
]
and
\
if
instance_information
[
'frontend-url-list'
]
and
\
instance_information
[
'user'
]
and
\
instance_information
[
'user'
]
and
\
instance_information
[
'password'
]:
instance_information
[
'password'
]:
break
break
logger
.
info
(
"Wait for frontend instanciation."
)
time
.
sleep
(
60
)
time
.
sleep
(
60
)
instance_information
=
self
.
slapos_communicator
.
getInstanceUrlDict
()
instance_information
=
self
.
slapos_communicator
.
getInstanceUrlDict
()
logger
.
info
(
instance_information
)
if
not
instance_information
[
'frontend-url-list'
]:
if
not
instance_information
[
'frontend-url-list'
]:
raise
ValueError
(
"Error getting instance information: frontend url not available"
)
raise
ValueError
(
"Error getting instance information: frontend url not available"
)
# support case of already preconfigured frontend which should be used
# instead of instance's default frontends
if
self
.
frontend_address
is
not
None
:
logger
.
info
(
"Overide frontend: %s"
%
self
.
frontend_address
)
instance_information
[
'frontend-url-list'
]
=
[[
"user"
,
self
.
frontend_address
]]
instance_url
=
suite
.
getScalabilityTestUrl
(
instance_information
)
instance_url
=
suite
.
getScalabilityTestUrl
(
instance_information
)
bootstrap_url
=
suite
.
getBootstrapScalabilityTestUrl
(
instance_information
,
count
)
bootstrap_url
=
suite
.
getBootstrapScalabilityTestUrl
(
instance_information
,
count
)
metric_url
=
suite
.
getScalabilityTestMetricUrl
(
instance_information
)
metric_url
=
suite
.
getScalabilityTestMetricUrl
(
instance_information
)
...
@@ -582,7 +614,7 @@ Require valid-user
...
@@ -582,7 +614,7 @@ Require valid-user
logger
.
info
(
"Test case for count : %d is in a running state."
%
count
)
logger
.
info
(
"Test case for count : %d is in a running state."
%
count
)
try
:
try
:
instance_url
,
bootstrap_url
,
metric_url
,
site_availability_url
=
self
.
getInstanceInformation
(
suite
,
count
)
instance_url
,
bootstrap_url
,
metric_url
,
site_availability_url
=
self
.
getInstanceInformation
(
suite
,
count
,
node_test_suite
)
except
Exception
as
e
:
except
Exception
as
e
:
error_message
=
"Error getting testsuite information: "
+
str
(
e
)
error_message
=
"Error getting testsuite information: "
+
str
(
e
)
break
break
...
@@ -649,11 +681,12 @@ Require valid-user
...
@@ -649,11 +681,12 @@ Require valid-user
error_message
=
"Error in communication with master: "
+
str
(
e
)
error_message
=
"Error in communication with master: "
+
str
(
e
)
break
break
# Remove installed software
# Remove installed software, only if it's a fresh software release and new instance
self
.
authorize_supply
=
True
if
not
self
.
use_existing_setup
and
self
.
instance_software_release
is
None
:
logger
.
info
(
"Removing installed software"
)
self
.
authorize_supply
=
True
for
computer_guid
in
self
.
involved_nodes_computer_guid
:
logger
.
info
(
"Removing installed software"
)
self
.
_prepareSlapOS
(
self
.
reachable_profile
,
computer_guid
,
state
=
"destroyed"
)
for
computer_guid
in
self
.
involved_nodes_computer_guid
:
self
.
_prepareSlapOS
(
self
.
reachable_profile
,
computer_guid
,
state
=
"destroyed"
)
# If error appears then that's a test failure.
# If error appears then that's a test failure.
if
error_message
:
if
error_message
:
...
...
erp5/util/testnode/SlapOSMasterCommunicator.py
View file @
1418705c
...
@@ -232,8 +232,8 @@ class SlapOSMasterCommunicator(object):
...
@@ -232,8 +232,8 @@ class SlapOSMasterCommunicator(object):
except
slapos
.
slap
.
ServerError
:
except
slapos
.
slap
.
ServerError
:
logger
.
error
(
'Got an error requesting partition for its state'
)
logger
.
error
(
'Got an error requesting partition for its state'
)
return
INSTANCE_STATE_UNKNOWN
return
INSTANCE_STATE_UNKNOWN
except
Exception
:
except
Exception
,
err
:
logger
.
error
(
"ERROR getting instance state
"
)
logger
.
error
(
"ERROR getting instance state
: %s"
%
err
)
return
INSTANCE_STATE_UNKNOWN
return
INSTANCE_STATE_UNKNOWN
started
=
0
started
=
0
...
...
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