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
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
Klaus Wölfel
slapos.core
Commits
4bb2d340
Commit
4bb2d340
authored
Oct 31, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test computer.reportComputerBang
parent
2bf9054c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
1 deletion
+55
-1
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
...mplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
+54
-0
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
No files found.
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCoreComputerSlapInterfaceWorkflow.py
View file @
4bb2d340
...
@@ -68,3 +68,57 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
...
@@ -68,3 +68,57 @@ class TestSlapOSCoreComputerSlapInterfaceWorkflow(testSlapOSMixin):
self
.
assertEqual
(
person_user
.
getRelativeUrl
(),
self
.
assertEqual
(
person_user
.
getRelativeUrl
(),
computer
.
getSourceAdministration
())
computer
.
getSourceAdministration
())
self
.
assertEqual
(
'validated'
,
computer
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
computer
.
getValidationState
())
def
_countInstanceBang
(
self
,
instance
,
comment
):
return
len
([
q
for
q
in
instance
.
workflow_history
[
'instance_slap_interface_workflow'
]
if
q
[
'action'
]
==
'bang'
and
\
q
[
'comment'
]
==
comment
])
def
_countComputereBang
(
self
,
computer
,
comment
):
return
len
([
q
for
q
in
computer
.
workflow_history
[
'computer_slap_interface_workflow'
]
if
q
[
'action'
]
==
\
'report_computer_bang'
and
q
[
'comment'
]
==
comment
])
def
test_reportComputerBang
(
self
):
self
.
_makeComplexComputer
()
self
.
login
(
self
.
computer
.
getReference
())
comment
=
'Bang from computer'
started_instance
=
self
.
computer
.
partition1
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
stopped_instance
=
self
.
computer
.
partition2
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
destroyed_instance1
=
self
.
computer
.
partition3
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
destroyed_instance2
=
self
.
computer
.
partition4
.
getAggregateRelatedValue
(
portal_type
=
'Software Instance'
)
# test sanity check -- do not trust _makeComplexComputer
self
.
assertEqual
(
'start_requested'
,
started_instance
.
getSlapState
())
self
.
assertEqual
(
'stop_requested'
,
stopped_instance
.
getSlapState
())
self
.
assertEqual
(
'destroy_requested'
,
destroyed_instance1
.
getSlapState
())
self
.
assertEqual
(
'destroy_requested'
,
destroyed_instance2
.
getSlapState
())
# store counts before bang
computer_bang_count
=
self
.
_countComputereBang
(
self
.
computer
,
comment
)
started_instance_bang_count
=
self
.
_countInstanceBang
(
started_instance
,
comment
)
stopped_instance_bang_count
=
self
.
_countInstanceBang
(
stopped_instance
,
comment
)
destroyed_instance1_bang_count
=
self
.
_countInstanceBang
(
destroyed_instance1
,
comment
)
destroyed_instance2_bang_count
=
self
.
_countInstanceBang
(
destroyed_instance2
,
comment
)
self
.
computer
.
reportComputerBang
(
comment
=
comment
)
self
.
tic
()
self
.
assertEqual
(
1
+
computer_bang_count
,
self
.
_countComputereBang
(
self
.
computer
,
comment
))
self
.
assertEqual
(
1
+
started_instance_bang_count
,
self
.
_countInstanceBang
(
started_instance
,
comment
))
self
.
assertEqual
(
1
+
stopped_instance_bang_count
,
self
.
_countInstanceBang
(
stopped_instance
,
comment
))
self
.
assertEqual
(
destroyed_instance1_bang_count
,
self
.
_countInstanceBang
(
destroyed_instance1
,
comment
))
self
.
assertEqual
(
destroyed_instance2_bang_count
,
self
.
_countInstanceBang
(
destroyed_instance2
,
comment
))
master/bt5/slapos_cloud/bt/revision
View file @
4bb2d340
155
156
\ No newline at end of file
\ 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