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
Boxiang Sun
slapos.core
Commits
00d126f5
Commit
00d126f5
authored
Sep 17, 2013
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[slapos_cloud] Test for Capacity at Computer Models
parent
c5caf8f0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
9 deletions
+146
-9
master/bt5/slapos_cloud/PathTemplateItem/computer_model_module/template_computer_model.xml
...ateItem/computer_model_module/template_computer_model.xml
+82
-0
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
...bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
+61
-8
master/bt5/slapos_cloud/bt/revision
master/bt5/slapos_cloud/bt/revision
+1
-1
master/bt5/slapos_cloud/bt/template_path_list
master/bt5/slapos_cloud/bt/template_path_list
+2
-0
No files found.
master/bt5/slapos_cloud/PathTemplateItem/computer_model_module/template_computer_model.xml
0 → 100644
View file @
00d126f5
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Computer Model"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Add_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_Modify_portal_content_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Author
</string>
<string>
Manager
</string>
<string>
Owner
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
capacity_quantity
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
template_computer_model
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Computer Model
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
template_computer_model
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_cloud/TestTemplateItem/testSlapOSCloudAlarm.py
View file @
00d126f5
...
@@ -1089,6 +1089,66 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
...
@@ -1089,6 +1089,66 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
'open'
,
self
.
computer
.
getCapacityScope
())
def
_newComputerModel
(
self
,
quantity
=
None
):
computer_model
=
self
.
portal
.
computer_model_module
.
\
template_computer_model
.
Base_createCloneDocument
(
batch_mode
=
1
)
computer_model
.
edit
(
capacity_quantity
=
quantity
,
reference
=
'TESTCM-%s'
%
self
.
generateNewId
(),
)
return
computer_model
def
_addPartitionToComputer
(
self
):
partition
=
self
.
computer
.
newContent
(
portal_type
=
'Computer Partition'
,
reference
=
'part1'
)
partition
.
markFree
()
partition
.
markBusy
()
partition
.
validate
()
self
.
software_instance
.
setAggregate
(
partition
.
getRelativeUrl
())
self
.
tic
()
def
test_Computer_checkAndUpdateCapacityScope_model
(
self
):
computer_model
=
self
.
_newComputerModel
(
9999
)
self
.
computer
.
edit
(
specialise_value
=
computer_model
,
capacity_quantity
=
None
)
transaction
.
commit
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
computer_model
.
getCapacityQuantity
(),
self
.
computer
.
getCapacityQuantity
())
def
test_Computer_checkAndUpdateCapacityScope_model_no_capacity
(
self
):
self
.
_makeTree
()
computer_model
=
self
.
_newComputerModel
(
1
)
self
.
computer
.
edit
(
specialise_value
=
computer_model
,
capacity_quantity
=
None
)
self
.
_addPartitionToComputer
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'close'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
'Computer capacity limit exceeded'
,
self
.
computer
.
workflow_history
[
'edit_workflow'
][
-
1
][
'comment'
])
self
.
assertEqual
(
computer_model
.
getCapacityQuantity
(),
self
.
computer
.
getCapacityQuantity
())
def
test_Computer_checkAndUpdateCapacityScope_model_has_capacity
(
self
):
# If capacity is set on computer, model value is ignored.
self
.
_makeTree
()
computer_model
=
self
.
_newComputerModel
(
1
)
self
.
computer
.
edit
(
specialise_value
=
computer_model
,
capacity_quantity
=
2
)
self
.
_addPartitionToComputer
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'open'
,
self
.
computer
.
getCapacityScope
())
self
.
assertNotEqual
(
computer_model
.
getCapacityQuantity
(),
self
.
computer
.
getCapacityQuantity
())
def
test_Computer_checkAndUpdateCapacityScope_with_old_access
(
self
):
def
test_Computer_checkAndUpdateCapacityScope_with_old_access
(
self
):
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
memcached_dict
=
self
.
portal
.
portal_memcached
.
getMemcachedDict
(
key_prefix
=
'slap_tool'
,
key_prefix
=
'slap_tool'
,
...
@@ -1106,14 +1166,7 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
...
@@ -1106,14 +1166,7 @@ class TestSlapOSUpdateComputerCapacityScopeAlarm(testSlapOSMixin):
def
test_Computer_checkAndUpdateCapacityScope_no_capacity_quantity
(
self
):
def
test_Computer_checkAndUpdateCapacityScope_no_capacity_quantity
(
self
):
self
.
_makeTree
()
self
.
_makeTree
()
self
.
computer
.
edit
(
capacity_quantity
=
1
)
self
.
computer
.
edit
(
capacity_quantity
=
1
)
partition
=
self
.
computer
.
newContent
(
portal_type
=
'Computer Partition'
,
self
.
_addPartitionToComputer
()
reference
=
'part1'
)
partition
.
markFree
()
partition
.
markBusy
()
partition
.
validate
()
self
.
software_instance
.
setAggregate
(
partition
.
getRelativeUrl
())
self
.
tic
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
computer
.
Computer_checkAndUpdateCapacityScope
()
self
.
assertEqual
(
'close'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
'close'
,
self
.
computer
.
getCapacityScope
())
self
.
assertEqual
(
'Computer capacity limit exceeded'
,
self
.
assertEqual
(
'Computer capacity limit exceeded'
,
...
...
master/bt5/slapos_cloud/bt/revision
View file @
00d126f5
300
301
\ No newline at end of file
\ No newline at end of file
master/bt5/slapos_cloud/bt/template_path_list
View file @
00d126f5
acl_users/slapos_access_token_extraction
acl_users/slapos_access_token_extraction
acl_users/slapos_machine
acl_users/slapos_machine
acl_users/slapos_shadow
acl_users/slapos_shadow
computer_model_module/template_computer_model
computer_model_module/template_computer_model/**
computer_module/template_computer
computer_module/template_computer
computer_module/template_computer/**
computer_module/template_computer/**
hosting_subscription_module/template_hosting_subscription
hosting_subscription_module/template_hosting_subscription
...
...
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