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
Amer
erp5
Commits
e028637b
Commit
e028637b
authored
Jul 18, 2013
by
Benjamin Blanc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testnode: add isHostingSubscriptionCorrectly method
parent
392574e7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
21 deletions
+42
-21
erp5/tests/testERP5TestNode.py
erp5/tests/testERP5TestNode.py
+12
-12
erp5/util/testnode/ScalabilityTestRunner.py
erp5/util/testnode/ScalabilityTestRunner.py
+8
-3
erp5/util/testnode/SlapOSMasterCommunicator.py
erp5/util/testnode/SlapOSMasterCommunicator.py
+22
-6
No files found.
erp5/tests/testERP5TestNode.py
View file @
e028637b
...
@@ -500,7 +500,7 @@ revision = %(revision2)s
...
@@ -500,7 +500,7 @@ revision = %(revision2)s
"launchable"
:
False
,
"randomized_path"
:
"azertyuiop"
})
"launchable"
:
False
,
"randomized_path"
:
"azertyuiop"
})
def
patch_isMasterTestnode
(
self
,
*
args
,
**
kw
):
def
patch_isMasterTestnode
(
self
,
*
args
,
**
kw
):
return
(
grade
==
'master'
)
return
(
grade
==
'master'
)
def
patch_is
Instance
Correctly
(
self
,
*
args
,
**
kw
):
def
patch_is
HostingSubscription
Correctly
(
self
,
*
args
,
**
kw
):
return
True
return
True
test_self
=
self
test_self
=
self
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
...
@@ -567,14 +567,14 @@ revision = %(revision2)s
...
@@ -567,14 +567,14 @@ revision = %(revision2)s
original_generateConfiguration
=
TaskDistributor
.
generateConfiguration
original_generateConfiguration
=
TaskDistributor
.
generateConfiguration
original_isMasterTestnode
=
TaskDistributor
.
isMasterTestnode
original_isMasterTestnode
=
TaskDistributor
.
isMasterTestnode
original_updateInstanceXML
=
RunnerClass
.
_updateInstanceXML
original_updateInstanceXML
=
RunnerClass
.
_updateInstanceXML
original_is
InstanceCorrectly
=
SlapOSMasterCommunicator
.
isInstance
Correctly
original_is
HostingSubscriptionCorrectly
=
SlapOSMasterCommunicator
.
isHostingSubscription
Correctly
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
TaskDistributor
.
getSlaposAccountKey
=
patch_getSlaposAccountKey
TaskDistributor
.
getSlaposAccountKey
=
patch_getSlaposAccountKey
TaskDistributor
.
getSlaposAccountCertificate
=
patch_getSlaposAccountCertificate
TaskDistributor
.
getSlaposAccountCertificate
=
patch_getSlaposAccountCertificate
TaskDistributor
.
generateConfiguration
=
patch_generateConfiguration
TaskDistributor
.
generateConfiguration
=
patch_generateConfiguration
TaskDistributor
.
isMasterTestnode
=
patch_isMasterTestnode
TaskDistributor
.
isMasterTestnode
=
patch_isMasterTestnode
RunnerClass
.
_updateInstanceXML
=
doNothing
RunnerClass
.
_updateInstanceXML
=
doNothing
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
patch_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
patch_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
doNothing
SlapOSMasterCommunicator
.
__init__
=
doNothing
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_subscribeNode
=
TaskDistributor
.
subscribeNode
...
@@ -604,7 +604,7 @@ revision = %(revision2)s
...
@@ -604,7 +604,7 @@ revision = %(revision2)s
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
generateConfiguration
=
original_generateConfiguration
TaskDistributor
.
isMasterTestnode
=
original_isMasterTestnode
TaskDistributor
.
isMasterTestnode
=
original_isMasterTestnode
RunnerClass
.
_updateInstanceXML
=
original_updateInstanceXML
RunnerClass
.
_updateInstanceXML
=
original_updateInstanceXML
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
original_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
original_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributionTool
.
createTestResult
=
original_createTestResult
TaskDistributionTool
.
createTestResult
=
original_createTestResult
...
@@ -666,7 +666,7 @@ revision = %(revision2)s
...
@@ -666,7 +666,7 @@ revision = %(revision2)s
"launchable"
:
False
,
"randomized_path"
:
"azertyuiop"
})
"launchable"
:
False
,
"randomized_path"
:
"azertyuiop"
})
def
patch_isMasterTestnode
(
self
,
*
args
,
**
kw
):
def
patch_isMasterTestnode
(
self
,
*
args
,
**
kw
):
return
grade
==
'master'
return
grade
==
'master'
def
patch_is
Instance
Correctly
(
self
,
*
args
,
**
kw
):
def
patch_is
HostingSubscription
Correctly
(
self
,
*
args
,
**
kw
):
return
True
return
True
test_self
=
self
test_self
=
self
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
...
@@ -721,7 +721,7 @@ revision = %(revision2)s
...
@@ -721,7 +721,7 @@ revision = %(revision2)s
original_supply
=
SlapOSControler
.
supply
original_supply
=
SlapOSControler
.
supply
original_request
=
SlapOSControler
.
request
original_request
=
SlapOSControler
.
request
original_updateInstanceXML
=
RunnerClass
.
_updateInstanceXML
original_updateInstanceXML
=
RunnerClass
.
_updateInstanceXML
original_is
InstanceCorrectly
=
SlapOSMasterCommunicator
.
isInstance
Correctly
original_is
HostingSubscriptionCorrectly
=
SlapOSMasterCommunicator
.
isHostingSubscription
Correctly
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
TaskDistributor
.
getSlaposAccountKey
=
patch_getSlaposAccountKey
TaskDistributor
.
getSlaposAccountKey
=
patch_getSlaposAccountKey
TaskDistributor
.
getSlaposAccountCertificate
=
patch_getSlaposAccountCertificate
TaskDistributor
.
getSlaposAccountCertificate
=
patch_getSlaposAccountCertificate
...
@@ -730,7 +730,7 @@ revision = %(revision2)s
...
@@ -730,7 +730,7 @@ revision = %(revision2)s
SlapOSControler
.
supply
=
doNothing
SlapOSControler
.
supply
=
doNothing
SlapOSControler
.
request
=
doNothing
SlapOSControler
.
request
=
doNothing
RunnerClass
.
_updateInstanceXML
=
doNothing
RunnerClass
.
_updateInstanceXML
=
doNothing
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
patch_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
patch_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
doNothing
SlapOSMasterCommunicator
.
__init__
=
doNothing
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_startTestSuite
=
TaskDistributor
.
startTestSuite
original_subscribeNode
=
TaskDistributor
.
subscribeNode
original_subscribeNode
=
TaskDistributor
.
subscribeNode
...
@@ -760,7 +760,7 @@ revision = %(revision2)s
...
@@ -760,7 +760,7 @@ revision = %(revision2)s
SlapOSControler
.
supply
=
original_supply
SlapOSControler
.
supply
=
original_supply
SlapOSControler
.
request
=
original_request
SlapOSControler
.
request
=
original_request
SlapOSControler
.
updateInstanceXML
=
original_updateInstanceXML
SlapOSControler
.
updateInstanceXML
=
original_updateInstanceXML
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
original_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
original_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributor
.
startTestSuite
=
original_startTestSuite
TaskDistributionTool
.
createTestResult
=
original_createTestResult
TaskDistributionTool
.
createTestResult
=
original_createTestResult
...
@@ -936,7 +936,7 @@ revision = %(revision2)s
...
@@ -936,7 +936,7 @@ revision = %(revision2)s
return
"Certificate"
return
"Certificate"
def
patch_getTestType
(
self
,
*
args
,
**
kw
):
def
patch_getTestType
(
self
,
*
args
,
**
kw
):
return
"ScalabilityTest"
return
"ScalabilityTest"
def
patch_is
Instance
Correctly
(
self
,
*
args
,
**
kw
):
def
patch_is
HostingSubscription
Correctly
(
self
,
*
args
,
**
kw
):
return
True
return
True
test_self
=
self
test_self
=
self
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
test_result_path_root
=
os
.
path
.
join
(
test_self
.
_temp_dir
,
'test/results'
)
...
@@ -959,7 +959,7 @@ revision = %(revision2)s
...
@@ -959,7 +959,7 @@ revision = %(revision2)s
original_supply
=
SlapOSControler
.
supply
original_supply
=
SlapOSControler
.
supply
original_request
=
SlapOSControler
.
request
original_request
=
SlapOSControler
.
request
original_updateInstanceXML
=
SlapOSControler
.
updateInstanceXML
original_updateInstanceXML
=
SlapOSControler
.
updateInstanceXML
original_is
InstanceCorrectly
=
SlapOSMasterCommunicator
.
isInstance
Correctly
original_is
HostingSubscriptionCorrectly
=
SlapOSMasterCommunicator
.
isHostingSubscription
Correctly
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
original_SlapOSMasterCommunicator__init__
=
SlapOSMasterCommunicator
.
__init__
#
#
...
@@ -977,7 +977,7 @@ revision = %(revision2)s
...
@@ -977,7 +977,7 @@ revision = %(revision2)s
SlapOSControler
.
supply
=
doNothing
SlapOSControler
.
supply
=
doNothing
SlapOSControler
.
request
=
doNothing
SlapOSControler
.
request
=
doNothing
SlapOSControler
.
updateInstanceXML
=
doNothing
SlapOSControler
.
updateInstanceXML
=
doNothing
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
patch_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
patch_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
doNothing
SlapOSMasterCommunicator
.
__init__
=
doNothing
# Run
# Run
test_node
=
self
.
getTestNode
()
test_node
=
self
.
getTestNode
()
...
@@ -996,6 +996,6 @@ revision = %(revision2)s
...
@@ -996,6 +996,6 @@ revision = %(revision2)s
SlapOSControler
.
supply
=
original_supply
SlapOSControler
.
supply
=
original_supply
SlapOSControler
.
request
=
original_request
SlapOSControler
.
request
=
original_request
SlapOSControler
.
updateInstanceXML
=
original_updateInstanceXML
SlapOSControler
.
updateInstanceXML
=
original_updateInstanceXML
SlapOSMasterCommunicator
.
is
InstanceCorrectly
=
original_isInstance
Correctly
SlapOSMasterCommunicator
.
is
HostingSubscriptionCorrectly
=
original_isHostingSubscription
Correctly
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
SlapOSMasterCommunicator
.
__init__
=
original_SlapOSMasterCommunicator__init__
time
.
sleep
=
original_sleep
time
.
sleep
=
original_sleep
erp5/util/testnode/ScalabilityTestRunner.py
View file @
e028637b
...
@@ -46,6 +46,7 @@ from erp5.util import taskdistribution
...
@@ -46,6 +46,7 @@ from erp5.util import taskdistribution
# for dummy slapos answer
# for dummy slapos answer
import
signal
import
signal
MAX_INSTANCE_TIME
=
60
*
60
# 1 hour
class
ScalabilityTestRunner
():
class
ScalabilityTestRunner
():
def
__init__
(
self
,
testnode
):
def
__init__
(
self
,
testnode
):
...
@@ -181,7 +182,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -181,7 +182,7 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
Return true if the specified instance is ready.
Return true if the specified instance is ready.
This method should communicates with SlapOS Master.
This method should communicates with SlapOS Master.
"""
"""
return
self
.
slapos_communicator
.
is
Instance
Correctly
(
instance_title
,
state
)
return
self
.
slapos_communicator
.
is
HostingSubscription
Correctly
(
instance_title
,
state
)
def
remainSoftwareToInstall
(
self
):
def
remainSoftwareToInstall
(
self
):
"""
"""
...
@@ -209,9 +210,13 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
...
@@ -209,9 +210,13 @@ late a SlapOS (positive) answer." %(str(os.getpid()),str(os.getpid()),))
# Used to simulate slapOS answer
# Used to simulate slapOS answer
def
_waitInstance
(
self
,
instance_title
,
state
):
def
_waitInstance
(
self
,
instance_title
,
state
):
self
.
log
(
"Wait for instance state: %s"
%
state
)
self
.
log
(
"Wait for instance state: %s"
%
state
)
while
(
not
self
.
isInstanceReady
(
instance_title
,
state
)):
#TODO: add a time limit
max_time
=
MAX_INSTANCE_TIME
start_time
=
0
while
(
not
self
.
isInstanceReady
(
instance_title
,
state
)
and
(
max_time
>
(
time
.
time
()
-
start_time
))):
time
.
sleep
(
15
)
time
.
sleep
(
15
)
pass
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
def
prepareSlapOSForTestSuite
(
self
,
node_test_suite
):
"""
"""
...
...
erp5/util/testnode/SlapOSMasterCommunicator.py
View file @
e028637b
...
@@ -117,6 +117,7 @@ class SlapOSMasterCommunicator(object):
...
@@ -117,6 +117,7 @@ class SlapOSMasterCommunicator(object):
return
False
return
False
return
len
(
related_instance_link_list
)
>
0
return
len
(
related_instance_link_list
)
>
0
# check if requested state = status
def
isInstanceCorrect
(
self
,
instance_link
):
def
isInstanceCorrect
(
self
,
instance_link
):
"""
"""
Return True if instance status and instance news text ~looks corresponding.
Return True if instance status and instance news text ~looks corresponding.
...
@@ -129,6 +130,19 @@ class SlapOSMasterCommunicator(object):
...
@@ -129,6 +130,19 @@ class SlapOSMasterCommunicator(object):
requested_status
=
instance
[
'status'
]
requested_status
=
instance
[
'status'
]
return
(
'Instance'
in
text
)
and
(
'correctly'
in
text
)
and
(
requested_status
in
text
)
return
(
'Instance'
in
text
)
and
(
'correctly'
in
text
)
and
(
requested_status
in
text
)
# check if requested state = status
def
isHostingSubscriptionCorrect
(
self
,
hosting_subscription_title
):
"""
Return True if all instance news related to hosting_subscription_title
correspond to the requested status.
"""
instance_link_list
=
self
.
_getRelatedInstanceLink
(
hosting_subscription_title
)
for
instance_link
in
instance_link_list
:
if
not
communicator
.
isInstanceCorrect
(
instance_link
):
return
False
return
len
(
instance_link_list
)
>
0
# check if provided 'status' = status
def
isInstanceCorrectly
(
self
,
instance_link
,
status
):
def
isInstanceCorrectly
(
self
,
instance_link
,
status
):
"""
"""
Return True if instance status and instance news text ~looks corresponding.
Return True if instance status and instance news text ~looks corresponding.
...
@@ -137,14 +151,16 @@ class SlapOSMasterCommunicator(object):
...
@@ -137,14 +151,16 @@ class SlapOSMasterCommunicator(object):
text
=
self
.
getNewsFromInstanceLink
(
instance_link
)[
'news'
][
0
][
'text'
]
text
=
self
.
getNewsFromInstanceLink
(
instance_link
)[
'news'
][
0
][
'text'
]
return
(
'Instance'
in
text
)
and
(
'correctly'
in
text
)
and
(
status
in
text
)
return
(
'Instance'
in
text
)
and
(
'correctly'
in
text
)
and
(
status
in
text
)
def
isHostingSubscriptionCorrect
(
self
,
hosting_subscription_title
):
# check if provided 'status' = status
def
isHostingSubscriptionCorrectly
(
self
,
hosting_subscription_title
,
status
):
"""
"""
Return True if all instance
news related to hosting_subscription_title
Return True if all instance
status and instance news text ~looks corresponding.
correspond to the requested status
.
( use the matching of 'correctly' and 'Instance' and status )
.
"""
"""
instance_link_list
=
self
.
_getRelatedInstanceLink
(
'TestScalability_21423104630420'
)
instance_link_list
=
self
.
_getRelatedInstanceLink
(
hosting_subscription_title
)
for
instance_link
in
instance_link_list
:
for
instance_link
in
instance_link_list
:
if
not
communicator
.
isInstanceCorrect
(
instance_link
):
if
not
communicator
.
isInstanceCorrect
ly
(
instance_link
,
status
):
return
False
return
False
return
len
(
instance_link_list
)
>
0
return
len
(
instance_link_list
)
>
0
\ No newline at end of file
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