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
Frederic Thoma
erp5
Commits
9a5c4f09
Commit
9a5c4f09
authored
Aug 30, 2017
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Supply working: it installs the software correctly. Debbuging instantiation (request).
parent
ca9978f3
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
77 deletions
+88
-77
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+66
-69
erp5/util/testnode/SlapOSMasterCommunicator.py
erp5/util/testnode/SlapOSMasterCommunicator.py
+22
-8
No files found.
erp5/util/testnode/ScalabilityTestRunner.py
View file @
9a5c4f09
...
...
@@ -109,10 +109,7 @@ class ScalabilityTestRunner():
self
.
remaining_software_installation_dict
[
computer_guid
]
=
software_path
#self.slapos_controler.supply(software_path, computer_guid)
self
.
printCommunicatorInfo
(
"COMP-2732"
)
#self.slapos_communicator._supply("available")
self
.
slapos_communicator
.
_supply
(
"started"
)
# Here make a request via slapos controler ?
return
{
'status_code'
:
0
}
else
:
raise
ValueError
(
"Too late to supply now. ('self.authorize_supply' is False)"
)
...
...
@@ -126,8 +123,8 @@ class ScalabilityTestRunner():
instance_title
=
"Scalability-"
instance_title
+=
"("
+
test_suite_title
+
")-"
instance_title
+=
str
(
self
.
involved_nodes_computer_guid
).
replace
(
"'"
,
""
)
instance_title
+=
"-"
+
str
(
datetime
.
datetime
.
now
().
isoformat
())
+
"-"
instance_title
+=
"timestamp="
+
str
(
time
.
time
())
#
instance_title += "-"+str(datetime.datetime.now().isoformat())+"-"
#
instance_title += "timestamp="+str(time.time())
return
instance_title
def
_generateInstanceXML
(
self
,
software_configuration
,
...
...
@@ -158,22 +155,18 @@ class ScalabilityTestRunner():
#request_kw = {"_" : config}
request
=
{
"_"
:
config
}
request_kw
=
{
"partition_parameter_kw"
:
request
}
#self.log("config from soft
Conf, tResult & tS
uite: " + str(config))
#self.log("config from soft
ware_configuration, test_result & test_s
uite: " + str(config))
#self.log("request_kw: " + str(request_kw))
self
.
log
(
"Computer : "
+
str
(
self
.
launcher_nodes_computer_guid
[
0
]))
#
self.log("Computer : " + str(self.launcher_nodes_computer_guid[0]))
#self.slapos_controler.request(instance_title, software_path,
# "test", {"_" : config},
# self.launcher_nodes_computer_guid[0])
self
.
slapos_communicator
.
setName
(
instance_title
)
self
.
slapos_communicator
.
setRequestParameters
(
request_kw
)
# ROQUE: request commented because it's failing. Instance manually requested.
comp_partition
=
self
.
slapos_communicator
.
_request
(
"started"
)
self
.
log
(
"Requested computer partition: "
)
self
.
log
(
str
(
comp_partition
))
self
.
log
(
"Computer partition certificate:"
)
self
.
log
(
str
(
comp_partition
.
getCertificate
()))
# ROQUE: harcoded state (that should happens in the ._request )
self
.
slapos_communicator
.
forceSetState
(
'started'
)
#self.log("Computer partition certificate:")
#self.log(str(comp_partition.getCertificate()))
#self.slapos_communicator.forceSetState('started')
self
.
authorize_request
=
False
return
{
'status_code'
:
0
}
else
:
...
...
@@ -248,7 +241,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
Wait for 'max_time' an instance specific state
"""
# ROQUE: hardcoded max_time because instance installation fails
max_time
=
20
#
max_time = 20
self
.
log
(
"Wait for instance state: %s"
%
state
)
start_time
=
time
.
time
()
#while (not self.slapos_communicator.isHostingSubscriptionReady(instance_title, state)
...
...
@@ -274,7 +267,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
"""
Wait for 'max_time' the instance creation
"""
# R
I
OQUE: harcoded max_time
# ROQUE: harcoded max_time
max_time
=
20
self
.
log
(
"Instance title: "
+
str
(
instance_title
))
self
.
log
(
"Waiting for instance creation..."
)
...
...
@@ -397,6 +390,9 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
"https://"
,
"["
+
self
.
testnode
.
config
[
'httpd_ip'
]
+
"]"
+
":"
+
self
.
testnode
.
config
[
'httpd_software_access_port'
],
self
.
randomized_path
)
self
.
reachable_profile
=
os
.
path
.
join
(
self
.
reachable_address
,
"software.cfg"
)
# ROQUE: hardcoded software url until installation bug is solved
self
.
reachable_address
=
"https://lab.nexedi.com/rporchetto/telecom/tree/master"
self
.
reachable_profile
=
"https://lab.nexedi.com/rporchetto/telecom/raw/master/software_release/software.cfg"
self
.
log
(
"Reachable address: "
+
self
.
reachable_address
)
self
.
log
(
"Reachable profile: "
+
self
.
reachable_profile
)
...
...
@@ -444,11 +440,8 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# Launch instance
self
.
instance_title
=
self
.
_generateInstanceTitle
(
node_test_suite
.
test_suite_title
)
try
:
# ROQUE: the instance title is harcoded because the instance request is not working (this one was manually created)
#self.instance_title = "nxdcloud-onlinenet-scalabilitynode-001-TESTINSTANCE"
self
.
instance_title
=
"nxdcloud-onlinenet-scalabilitynode-001-INSTANCE-FOR-TESTING"
#self._createInstance(self.reachable_profile, configuration_list[0],
# self.instance_title, node_test_suite.test_result, node_test_suite.test_suite)
self
.
_createInstance
(
self
.
reachable_profile
,
configuration_list
[
0
],
self
.
instance_title
,
node_test_suite
.
test_result
,
node_test_suite
.
test_suite
)
self
.
log
(
"Scalability instance requested."
)
except
:
self
.
log
(
"Unable to launch instance"
)
...
...
@@ -458,54 +451,11 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
return
{
'status_code'
:
0
}
return
{
'status_code'
:
1
}
def
printCommunicatorInfo
(
self
,
computer_id
,
instance_url
=
None
):
self
.
log
(
"######## PRINTING SLAPOS MASTER COMMUNICATOR INFO ########"
)
#computer = self.slapos_communicator._hateoas_getComputer("COMP-2732")
computer
=
self
.
slapos_communicator
.
_hateoas_getComputer
(
computer_id
)
if
computer
is
not
None
:
#self.log("COMPUTER: " + str(computer))
software_installation_list
=
self
.
slapos_communicator
.
getSoftwareInstallationList
()
self
.
log
(
"software_installation_list: "
)
self
.
log
(
str
(
software_installation_list
))
getSoftwareInstallationNews
=
self
.
slapos_communicator
.
getSoftwareInstallationNews
()
self
.
log
(
"Software installation news: "
)
self
.
log
(
str
(
getSoftwareInstallationNews
))
getInstanceUrlList
=
self
.
slapos_communicator
.
getInstanceUrlList
()
self
.
log
(
"getInstanceUrlList"
)
self
.
log
(
str
(
getInstanceUrlList
))
# ROQUE: for debugging purposes
if
instance_url
is
not
None
:
#instance_url = 'https://api.vifib.com/software_instance_module/20170822-1568166F/ERP5Document_getHateoas'
self
.
log
(
"getNewsFromInstance(url)"
)
self
.
log
(
str
(
self
.
slapos_communicator
.
getNewsFromInstance
(
instance_url
)))
self
.
log
(
"getInformationFromInstance(url)"
)
self
.
log
(
str
(
self
.
slapos_communicator
.
getInformationFromInstance
(
instance_url
)))
# ROQUE: get info contains the software release url
getInfo
=
self
.
slapos_communicator
.
getInfo
()
self
.
log
(
"getInfo: "
)
self
.
log
(
str
(
getInfo
))
# "No message"
getFormatedLastMessage
=
self
.
slapos_communicator
.
getFormatedLastMessage
()
self
.
log
(
"getFormatedLastMessage: "
)
self
.
log
(
str
(
getFormatedLastMessage
))
getSoftwareState
=
self
.
slapos_communicator
.
_getSoftwareState
()
self
.
log
(
"Software state: "
+
str
(
getSoftwareState
))
getInstanceState
=
self
.
slapos_communicator
.
_getInstanceState
()
self
.
log
(
"Instance state: "
+
str
(
getInstanceState
))
self
.
log
(
"#######################################################"
)
def
runTestSuite
(
self
,
node_test_suite
,
portal_url
):
if
not
self
.
launchable
:
self
.
log
(
"Current test_suite is not actually launchable."
)
return
{
'status_code'
:
1
}
# Unable to continue due to not realizable configuration
if
True
:
self
.
log
(
"FORCE EXIT WITH ERROR UNTIL SOFTWARE INSTALLATION BUG IS FIXED."
)
return
{
'status_code'
:
1
}
configuration_list
=
node_test_suite
.
configuration_list
test_list
=
range
(
0
,
len
(
configuration_list
))
# create test_result
...
...
@@ -520,9 +470,9 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
error_message
=
None
# Each cluster configuration are tested
self
.
log
(
"FOR
CONFIG IN CONFIG_LIST:
"
)
self
.
log
(
"FOR
EACH CONFIGURATION:
"
)
for
configuration
in
configuration_list
:
self
.
log
(
"
configuration n
: "
+
str
(
count
))
self
.
log
(
"
CONFIGURATION N
: "
+
str
(
count
))
self
.
log
(
str
(
configuration
))
# First configuration doesn't need XML configuration update.
...
...
@@ -541,15 +491,19 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# XXX: Dirty hack used to force haproxy to restart in time
# with all zope informations.
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STARTED
)
#self._waitInstance(self.instance_title, SlapOSMasterCommunicator.INSTANCE_STATE_STARTED)
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STARTED_WITH_ERROR
)
#self.slapos_controler.stopInstance(self.instance_title)
self
.
slapos_communicator
.
_request
(
'stopped'
)
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STOPPED
)
#self._waitInstance(self.instance_title, SlapOSMasterCommunicator.INSTANCE_STATE_STOPPED)
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STARTED_WITH_ERROR
)
self
.
slapos_communicator
.
_request
(
'started'
)
#self.slapos_controler.startInstance(self.instance_title)
##########################################################
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STARTED
)
#self._waitInstance(self.instance_title, SlapOSMasterCommunicator.INSTANCE_STATE_STARTED)
self
.
_waitInstance
(
self
.
instance_title
,
SlapOSMasterCommunicator
.
INSTANCE_STATE_STARTED_WITH_ERROR
)
self
.
log
(
"INSTANCE CORRECTLY STARTED"
)
# Start only the current test
exclude_list
=
[
x
for
x
in
test_list
if
x
!=
test_list
[
count
]]
...
...
@@ -652,3 +606,46 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
if the software.cfg have to use relative path or not.
"""
return
True
def
printCommunicatorInfo
(
self
,
computer_id
,
instance_url
=
None
):
self
.
log
(
"################ PRINTING SLAPOS MASTER COMMUNICATOR INFO ################"
)
#computer = self.slapos_communicator._hateoas_getComputer("COMP-2732")
computer
=
self
.
slapos_communicator
.
_hateoas_getComputer
(
computer_id
)
if
computer
is
not
None
:
#self.log("COMPUTER: " + str(computer))
software_installation_list
=
self
.
slapos_communicator
.
getSoftwareInstallationList
()
self
.
log
(
"software_installation_list: "
)
self
.
log
(
str
(
software_installation_list
))
getSoftwareInstallationNews
=
self
.
slapos_communicator
.
getSoftwareInstallationNews
()
self
.
log
(
"Software installation news: "
)
#self.log(str(getSoftwareInstallationNews))
#getInstanceUrlList = self.slapos_communicator.getInstanceUrlList()
#self.log("getInstanceUrlList")
#self.log(str(getInstanceUrlList))
# ROQUE: for debugging purposes
if
instance_url
is
not
None
:
#instance_url = 'https://api.vifib.com/software_instance_module/20170822-1568166F/ERP5Document_getHateoas'
self
.
log
(
"getNewsFromInstance(url)"
)
self
.
log
(
str
(
self
.
slapos_communicator
.
getNewsFromInstance
(
instance_url
)))
self
.
log
(
"getInformationFromInstance(url)"
)
self
.
log
(
str
(
self
.
slapos_communicator
.
getInformationFromInstance
(
instance_url
)))
# ROQUE: get info contains the software release url
getInfo
=
self
.
slapos_communicator
.
getInfo
()
self
.
log
(
"getInfo: "
)
self
.
log
(
str
(
getInfo
))
# Always return "No message"
#getFormatedLastMessage = self.slapos_communicator.getFormatedLastMessage()
#self.log("getFormatedLastMessage: ")
#self.log(str(getFormatedLastMessage))
getSoftwareState
=
self
.
slapos_communicator
.
_getSoftwareState
()
self
.
log
(
"Software state: "
+
str
(
getSoftwareState
))
getInstanceState
=
self
.
slapos_communicator
.
_getInstanceState
()
self
.
log
(
"Instance state: "
+
str
(
getInstanceState
))
self
.
log
(
"##########################################################################"
)
erp5/util/testnode/SlapOSMasterCommunicator.py
View file @
9a5c4f09
...
...
@@ -411,7 +411,6 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
info_created_at
=
"-1"
is_slave
=
information
[
'slave'
]
if
is_slave
:
self
.
_logger
.
debug
(
'Instance is slave'
)
if
(
information
[
"connection_dict"
])
>
0
:
state
=
INSTANCE_STATE_STARTED
else
:
...
...
@@ -440,15 +439,22 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
monitor_v6_url
=
information
[
"connection_dict"
].
get
(
"monitor_v6_url"
)
try
:
monitor_information_dict
=
self
.
getRSSEntryFromMonitoring
(
monitor_v6_url
)
self
.
_logger
(
"[DEBUG] monitor information dictionary: "
)
self
.
_logger
(
str
(
monitor_information_dict
))
#
self._logger("[DEBUG] monitor information dictionary: ")
#
self._logger(str(monitor_information_dict))
except
Exception
:
self
.
_logger
.
exception
(
'Unable to download promises for: %s'
%
(
instance
[
"title"
]))
self
.
_logger
.
info
(
traceback
.
format_exc
())
self
.
_logger
(
traceback
.
format_exc
())
monitor_information_dict
=
{
"message"
:
"Unable to download"
}
#self._logger('Information of instance ' + instance["title"])
#self._logger("{")
self
.
_logger
(
'Instance state: %s -> %s'
%
(
instance
[
'title'
],
state
))
self
.
_logger
(
'Instance Created at: %s -> %s'
%
(
instance
[
'title'
],
info_created_at
))
#self._logger ('Instance Created at: %s -> %s' % (instance['title'], info_created_at))
#self._logger(str(information))
#self._logger("Instance news: ")
#self._logger(str(news))
self
.
_logger
(
"News: "
+
str
(
news
[
0
][
"text"
]))
#self._logger("}")
message_list
.
append
({
'title'
:
instance
[
"title"
],
...
...
@@ -464,12 +470,16 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
'its state'
)
return
INSTANCE_STATE_UNKNOWN
#self._logger("COMPLETE MESSAGE LIST: ")
#self._logger(str(message_list))
started
=
0
stopped
=
0
self
.
message_history
.
append
(
message_list
)
for
instance
in
message_list
:
if
not
instance
[
'slave'
]
and
\
instance
[
'state'
]
in
(
INSTANCE_STATE_UNKNOWN
,
INSTANCE_STATE_STARTED_WITH_ERROR
):
self
.
_logger
(
"RETURNING INSTANCE STATE: "
+
instance
[
'state'
]
+
" (not slave)"
)
return
instance
[
'state'
]
elif
not
instance
[
'slave'
]
and
instance
[
'state'
]
==
INSTANCE_STATE_STARTED
:
started
=
1
...
...
@@ -477,15 +487,19 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
stopped
=
1
if
instance
[
'slave'
]
and
instance
[
'state'
]
==
INSTANCE_STATE_UNKNOWN
:
self
.
_logger
(
"RETURNING INSTANCE STATE: UNKNOWN (slave+unknown)"
)
return
instance
[
'state'
]
if
started
and
stopped
:
self
.
_logger
(
"RETURNING INSTANCE STATE: UNKNOWN (started+stopped)"
)
return
INSTANCE_STATE_UNKNOWN
if
started
:
self
.
_logger
(
"RETURNING INSTANCE STATE: STARTED"
)
return
INSTANCE_STATE_STARTED
if
stopped
:
self
.
_logger
(
"RETURNING INSTANCE STATE: STOPPED"
)
return
INSTANCE_STATE_STOPPED
@
retryOnNetworkFailure
...
...
@@ -493,7 +507,7 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
"""
Interrupt a running test sequence, putting it in idle state.
"""
self
.
_logger
.
info
(
'Invoking TearDown for %s@%s'
%
(
self
.
url
,
self
.
name
))
self
.
_logger
(
'Invoking TearDown for %s@%s'
%
(
self
.
url
,
self
.
name
))
if
self
.
request_kw
is
not
None
:
self
.
_request
(
'destroyed'
)
if
self
.
computer_guid
is
not
None
:
...
...
@@ -505,7 +519,7 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
Check for missed deadlines (-> test failure), conditions for moving to
next state, and actually moving to next state (executing its payload).
"""
self
.
_logger
.
debug
(
'
TIC'
)
self
.
_logger
(
'[DEBUG]
TIC'
)
deadline
=
self
.
deadline
if
deadline
<
now
and
deadline
is
not
None
:
...
...
@@ -519,7 +533,7 @@ class SoftwareReleaseTester(SlapOSMasterCommunicator):
instance_state
is
None
or
instance_state
==
self
.
_getInstanceState
()):
self
.
_logger
.
debug
(
'
Going to state %s (%r)'
,
next_state
,
instance_state
)
self
.
_logger
(
'[DEBUG]
Going to state %s (%r)'
,
next_state
,
instance_state
)
if
next_state
is
None
:
return
None
...
...
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