Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Romain Courteaud
slapos.core
Commits
a5190f56
Commit
a5190f56
authored
Feb 15, 2024
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_crm: test: use PinnedDateTime context
parent
d249a665
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
75 deletions
+21
-75
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
...ateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
+15
-54
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+6
-21
No files found.
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMAlarm.py
View file @
a5190f56
...
@@ -21,7 +21,7 @@
...
@@ -21,7 +21,7 @@
#
#
##############################################################################
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
\
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
simulate
,
TemporaryAlarmScript
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
simulate
,
TemporaryAlarmScript
,
PinnedDateTime
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
difflib
import
difflib
import
transaction
import
transaction
...
@@ -1280,12 +1280,9 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
...
@@ -1280,12 +1280,9 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
'*args, **kwargs'
,
'return 0'
)
def
test_ComputeNode_checkState_script_oldAccessStatus
(
self
):
def
test_ComputeNode_checkState_script_oldAccessStatus
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
try
:
d
=
DateTime
()
-
1.1
d
=
DateTime
()
-
1.1
with
PinnedDateTime
(
self
,
d
):
self
.
pinDateTime
(
d
)
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
finally
:
self
.
unpinDateTime
()
compute_node_support_request
=
compute_node
.
ComputeNode_checkState
()
compute_node_support_request
=
compute_node
.
ComputeNode_checkState
()
self
.
assertNotEqual
(
compute_node_support_request
,
None
)
self
.
assertNotEqual
(
compute_node_support_request
,
None
)
...
@@ -1334,11 +1331,8 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
...
@@ -1334,11 +1331,8 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
def
test_ComputeNode_checkState_script_notify
(
self
):
def
test_ComputeNode_checkState_script_notify
(
self
):
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
portal
.
REQUEST
[
'test_ComputeNode_checkState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_ComputeNode_checkState_notify'
]
=
\
self
.
_makeNotificationMessage
(
compute_node
.
getReference
())
self
.
_makeNotificationMessage
(
compute_node
.
getReference
())
...
@@ -1423,11 +1417,8 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
...
@@ -1423,11 +1417,8 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
# Computer is getting access
# Computer is getting access
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
self
.
start_requested_software_instance
.
setAccessStatus
(
""
)
self
.
start_requested_software_instance
.
setAccessStatus
(
""
)
finally
:
self
.
unpinDateTime
()
compute_node
.
ComputeNode_checkState
()
compute_node
.
ComputeNode_checkState
()
self
.
tic
()
self
.
tic
()
...
@@ -1471,12 +1462,9 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
...
@@ -1471,12 +1462,9 @@ class TestSlapOSCrmMonitoringCheckComputeNodeState(SlapOSTestCaseMixinWithAbort)
# Computer is getting access
# Computer is getting access
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
self
.
start_requested_software_instance
.
setAccessStatus
(
""
)
self
.
start_requested_software_instance
.
setAccessStatus
(
""
)
self
.
start_requested_software_installation
.
setAccessStatus
(
""
)
self
.
start_requested_software_installation
.
setAccessStatus
(
""
)
finally
:
self
.
unpinDateTime
()
compute_node
.
ComputeNode_checkState
()
compute_node
.
ComputeNode_checkState
()
self
.
tic
()
self
.
tic
()
...
@@ -1558,13 +1546,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
...
@@ -1558,13 +1546,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
def
test_ComputeNode_checkSoftwareInstallationState_script_notifyNoInformation
(
self
):
def
test_ComputeNode_checkSoftwareInstallationState_script_notifyNoInformation
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
compute_node
=
self
.
compute_node
compute_node
=
self
.
compute_node
finally
:
self
.
unpinDateTime
()
self
.
tic
()
self
.
tic
()
self
.
portal
.
REQUEST
[
'test_ComputeNode_checkSoftwareInstallationState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_ComputeNode_checkSoftwareInstallationState_notify'
]
=
\
...
@@ -1608,13 +1593,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
...
@@ -1608,13 +1593,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
def
test_ComputeNode_checkSoftwareInstallationState_script_notifySlow
(
self
):
def
test_ComputeNode_checkSoftwareInstallationState_script_notifySlow
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
compute_node
=
self
.
compute_node
compute_node
=
self
.
compute_node
finally
:
self
.
unpinDateTime
()
self
.
start_requested_software_installation
.
setBuildingStatus
(
"building"
)
self
.
start_requested_software_installation
.
setBuildingStatus
(
"building"
)
self
.
tic
()
self
.
tic
()
...
@@ -1685,13 +1667,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
...
@@ -1685,13 +1667,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
def
test_ComputeNode_checkSoftwareInstallationState_script_notifyError
(
self
):
def
test_ComputeNode_checkSoftwareInstallationState_script_notifyError
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
compute_node
=
self
.
compute_node
compute_node
=
self
.
compute_node
finally
:
self
.
unpinDateTime
()
self
.
start_requested_software_installation
.
setErrorStatus
(
""
)
self
.
start_requested_software_installation
.
setErrorStatus
(
""
)
self
.
tic
()
self
.
tic
()
...
@@ -1734,13 +1713,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
...
@@ -1734,13 +1713,10 @@ class TestSlapOSCrmMonitoringCheckComputeNodeSoftwareInstallation(SlapOSTestCase
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
'context.REQUEST["test_ComputeNode_checkSoftwareInstallationState_notify"])'
)
def
test_ComputeNode_checkSoftwareInstallationState_script_oldBuild
(
self
):
def
test_ComputeNode_checkSoftwareInstallationState_script_oldBuild
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
compute_node
=
self
.
compute_node
compute_node
=
self
.
compute_node
finally
:
self
.
unpinDateTime
()
self
.
start_requested_software_installation
.
setAccessStatus
(
""
)
self
.
start_requested_software_installation
.
setAccessStatus
(
""
)
self
.
tic
()
self
.
tic
()
...
@@ -1819,16 +1795,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
...
@@ -1819,16 +1795,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_InstanceTree_checkSoftwareInstanceState_notify"])'
)
'context.REQUEST["test_InstanceTree_checkSoftwareInstanceState_notify"])'
)
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyError
(
self
):
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyError
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
software_instance
=
self
.
start_requested_software_instance
software_instance
=
self
.
start_requested_software_instance
instance_tree
=
software_instance
.
getSpecialiseValue
()
instance_tree
=
software_instance
.
getSpecialiseValue
()
software_instance
.
setErrorStatus
(
""
)
software_instance
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
...
@@ -1864,15 +1837,12 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
...
@@ -1864,15 +1837,12 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 0'
)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 0'
)
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyErrorTolerance
(
self
):
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyErrorTolerance
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
software_instance
=
self
.
start_requested_software_instance
software_instance
=
self
.
start_requested_software_instance
instance_tree
=
software_instance
.
getSpecialiseValue
()
instance_tree
=
software_instance
.
getSpecialiseValue
()
finally
:
self
.
unpinDateTime
()
software_instance
.
setErrorStatus
(
""
)
software_instance
.
setErrorStatus
(
""
)
...
@@ -1897,15 +1867,12 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
...
@@ -1897,15 +1867,12 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
'return context.restrictedTraverse('
\
'return context.restrictedTraverse('
\
'context.REQUEST["test_InstanceTree_checkSoftwareInstanceState_notify"])'
)
'context.REQUEST["test_InstanceTree_checkSoftwareInstanceState_notify"])'
)
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyNotAllocated
(
self
):
def
test_InstanceTree_checkSoftwareInstanceState_script_notifyNotAllocated
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1.1
):
self
.
pinDateTime
(
DateTime
()
-
1.1
)
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
software_instance
=
self
.
start_requested_software_instance
software_instance
=
self
.
start_requested_software_instance
instance_tree
=
software_instance
.
getSpecialiseValue
()
instance_tree
=
software_instance
.
getSpecialiseValue
()
finally
:
self
.
unpinDateTime
()
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
...
@@ -1942,16 +1909,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
...
@@ -1942,16 +1909,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 0'
)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 0'
)
def
test_InstanceTree_checkSoftwareInstanceState_script_tooEarly
(
self
):
def
test_InstanceTree_checkSoftwareInstanceState_script_tooEarly
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()):
self
.
pinDateTime
(
DateTime
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
software_instance
=
self
.
start_requested_software_instance
software_instance
=
self
.
start_requested_software_instance
instance_tree
=
software_instance
.
getSpecialiseValue
()
instance_tree
=
software_instance
.
getSpecialiseValue
()
software_instance
.
setErrorStatus
(
""
)
software_instance
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
...
@@ -1969,16 +1933,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
...
@@ -1969,16 +1933,13 @@ class TestSlapOSCrmMonitoringCheckInstanceInError(SlapOSTestCaseMixinWithAbort):
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 1'
)
@
simulate
(
'ERP5Site_isSupportRequestCreationClosed'
,
''
,
'return 1'
)
def
test_InstanceTree_checkSoftwareInstanceState_script_closed
(
self
):
def
test_InstanceTree_checkSoftwareInstanceState_script_closed
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
1
):
self
.
pinDateTime
(
DateTime
()
-
1
)
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
self
.
_makeComplexComputeNode
(
self
.
addProject
())
software_instance
=
self
.
start_requested_software_instance
software_instance
=
self
.
start_requested_software_instance
instance_tree
=
software_instance
.
getSpecialiseValue
()
instance_tree
=
software_instance
.
getSpecialiseValue
()
software_instance
.
setErrorStatus
(
""
)
software_instance
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
portal
.
REQUEST
[
'test_InstanceTree_checkSoftwareInstanceState_notify'
]
=
\
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
self
.
_makeNotificationMessage
(
instance_tree
.
getReference
())
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
a5190f56
...
@@ -23,7 +23,7 @@
...
@@ -23,7 +23,7 @@
import
transaction
import
transaction
from
erp5.component.test.SlapOSTestCaseMixin
import
\
from
erp5.component.test.SlapOSTestCaseMixin
import
\
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
TemporaryAlarmScript
SlapOSTestCaseMixin
,
SlapOSTestCaseMixinWithAbort
,
TemporaryAlarmScript
,
PinnedDateTime
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
App.Common
import
rfc1123_date
from
App.Common
import
rfc1123_date
...
@@ -169,22 +169,16 @@ class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
...
@@ -169,22 +169,16 @@ class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
has_contacted
)
self
.
assertTrue
(
has_contacted
)
def
test_ComputeNode_hasContactedRecently_no_data
(
self
):
def
test_ComputeNode_hasContactedRecently_no_data
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
32
):
self
.
pinDateTime
(
DateTime
()
-
32
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
finally
:
self
.
unpinDateTime
()
self
.
tic
()
self
.
tic
()
has_contacted
=
compute_node
.
ComputeNode_hasContactedRecently
()
has_contacted
=
compute_node
.
ComputeNode_hasContactedRecently
()
self
.
assertFalse
(
has_contacted
)
self
.
assertFalse
(
has_contacted
)
def
test_ComputeNode_hasContactedRecently_memcached
(
self
):
def
test_ComputeNode_hasContactedRecently_memcached
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
32
):
self
.
pinDateTime
(
DateTime
()
-
32
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
finally
:
self
.
unpinDateTime
()
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
self
.
tic
()
self
.
tic
()
...
@@ -193,12 +187,9 @@ class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
...
@@ -193,12 +187,9 @@ class TestComputeNode_hasContactedRecently(SlapOSTestCaseMixinWithAbort):
self
.
assertTrue
(
has_contacted
)
self
.
assertTrue
(
has_contacted
)
def
test_ComputeNode_hasContactedRecently_memcached_oudated_no_spl
(
self
):
def
test_ComputeNode_hasContactedRecently_memcached_oudated_no_spl
(
self
):
try
:
with
PinnedDateTime
(
self
,
DateTime
()
-
32
):
self
.
pinDateTime
(
DateTime
()
-
32
)
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
,
_
=
self
.
_makeComputeNode
(
self
.
addProject
())
compute_node
.
setAccessStatus
(
""
)
compute_node
.
setAccessStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
tic
()
self
.
tic
()
...
@@ -309,11 +300,8 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
...
@@ -309,11 +300,8 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
_
,
partition
=
self
.
_makeComputeNode
(
self
.
addProject
())
_
,
partition
=
self
.
_makeComputeNode
(
self
.
addProject
())
error_date
=
DateTime
()
error_date
=
DateTime
()
try
:
with
PinnedDateTime
(
self
,
error_date
):
self
.
pinDateTime
(
error_date
)
instance
.
setErrorStatus
(
""
)
instance
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
self
.
assertEqual
(
instance
.
SoftwareInstance_hasReportedError
(),
None
)
...
@@ -330,11 +318,8 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
...
@@ -330,11 +318,8 @@ class TestSlapOSHasError(SlapOSTestCaseMixin):
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
self
.
assertEqual
(
installation
.
SoftwareInstallation_hasReportedError
(),
None
)
error_date
=
DateTime
()
error_date
=
DateTime
()
try
:
with
PinnedDateTime
(
self
,
error_date
):
self
.
pinDateTime
(
error_date
)
installation
.
setErrorStatus
(
""
)
installation
.
setErrorStatus
(
""
)
finally
:
self
.
unpinDateTime
()
self
.
assertEqual
(
self
.
assertEqual
(
rfc1123_date
(
installation
.
SoftwareInstallation_hasReportedError
()),
rfc1123_date
(
installation
.
SoftwareInstallation_hasReportedError
()),
...
...
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