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
Cédric Le Ninivin
slapos.core
Commits
2ea03f18
Commit
2ea03f18
authored
Oct 30, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move out utility methods in order to have them shared.
parent
f23b64a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
176 deletions
+176
-176
master/bt5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
...5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
+0
-175
master/bt5/slapos_slap_tool/bt/revision
master/bt5/slapos_slap_tool/bt/revision
+1
-1
master/product/SlapOS/tests/testSlapOSMixin.py
master/product/SlapOS/tests/testSlapOSMixin.py
+175
-0
No files found.
master/bt5/slapos_slap_tool/TestTemplateItem/testSlapOSSlapTool.py
View file @
2ea03f18
...
@@ -69,185 +69,10 @@ class TestSlapOSSlapToolMixin(testSlapOSMixin):
...
@@ -69,185 +69,10 @@ class TestSlapOSSlapToolMixin(testSlapOSMixin):
self
.
computer_id
=
self
.
computer
.
getReference
()
self
.
computer_id
=
self
.
computer
.
getReference
()
self
.
pinDateTime
(
DateTime
())
self
.
pinDateTime
(
DateTime
())
def
_cleaupREQUEST
(
self
):
self
.
portal
.
REQUEST
[
'request_instance'
]
=
None
self
.
portal
.
REQUEST
.
headers
=
{}
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
self
.
unpinDateTime
()
self
.
unpinDateTime
()
self
.
_cleaupREQUEST
()
self
.
_cleaupREQUEST
()
def
_makeComplexComputer
(
self
):
for
i
in
range
(
1
,
5
):
id_
=
'partition%s'
%
i
p
=
self
.
computer
.
newContent
(
portal_type
=
'Computer Partition'
,
id
=
id_
,
title
=
id_
,
reference
=
id_
,
default_network_address_ip_address
=
'ip_address_%s'
%
i
,
default_network_address_netmask
=
'netmask_%s'
%
i
)
p
.
markFree
()
p
.
validate
()
self
.
start_requested_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
start_requested_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Start requested for %s'
%
self
.
computer
.
getTitle
()
)
self
.
start_requested_software_installation
.
validate
()
self
.
start_requested_software_installation
.
requestStart
()
self
.
destroy_requested_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
destroy_requested_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Destroy requested for %s'
%
self
.
computer
.
getTitle
()
)
self
.
destroy_requested_software_installation
.
validate
()
self
.
destroy_requested_software_installation
.
requestStart
()
self
.
destroy_requested_software_installation
.
requestDestroy
()
self
.
destroyed_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
destroyed_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Destroyed for %s'
%
self
.
computer
.
getTitle
()
)
self
.
destroyed_software_installation
.
validate
()
self
.
destroyed_software_installation
.
requestStart
()
self
.
destroyed_software_installation
.
requestDestroy
()
self
.
destroyed_software_installation
.
invalidate
()
self
.
computer
.
partition1
.
markBusy
()
self
.
computer
.
partition2
.
markBusy
()
self
.
computer
.
partition3
.
markBusy
()
# prepare some trees
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'started'
)
hosting_subscription
.
requestStart
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
self
.
start_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
start_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition1
.
getRelativeUrl
())
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
self
.
stop_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
stop_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition2
.
getRelativeUrl
()
)
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
kw
[
'state'
]
=
'destroyed'
hosting_subscription
.
requestDestroy
(
**
kw
)
self
.
destroy_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
destroy_requested_software_instance
.
requestDestroy
(
**
kw
)
self
.
destroy_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition3
.
getRelativeUrl
()
)
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
kw
[
'state'
]
=
'destroyed'
hosting_subscription
.
requestDestroy
(
**
kw
)
self
.
destroyed_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
destroyed_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition4
.
getRelativeUrl
()
)
self
.
destroyed_software_instance
.
requestDestroy
(
**
kw
)
self
.
destroyed_software_instance
.
invalidate
()
self
.
tic
()
self
.
_cleaupREQUEST
()
class
TestSlapOSSlapToolComputerAccess
(
TestSlapOSSlapToolMixin
):
class
TestSlapOSSlapToolComputerAccess
(
TestSlapOSSlapToolMixin
):
def
_getPartitionXml
(
self
):
def
_getPartitionXml
(
self
):
return
"""
\
return
"""
\
...
...
master/bt5/slapos_slap_tool/bt/revision
View file @
2ea03f18
6
7
\ No newline at end of file
\ No newline at end of file
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
2ea03f18
...
@@ -139,6 +139,181 @@ class testSlapOSMixin(Products.Vifib.tests.VifibMixin.testVifibMixin):
...
@@ -139,6 +139,181 @@ class testSlapOSMixin(Products.Vifib.tests.VifibMixin.testVifibMixin):
]
]
return
result
return
result
def
_makeComplexComputer
(
self
):
for
i
in
range
(
1
,
5
):
id_
=
'partition%s'
%
i
p
=
self
.
computer
.
newContent
(
portal_type
=
'Computer Partition'
,
id
=
id_
,
title
=
id_
,
reference
=
id_
,
default_network_address_ip_address
=
'ip_address_%s'
%
i
,
default_network_address_netmask
=
'netmask_%s'
%
i
)
p
.
markFree
()
p
.
validate
()
self
.
start_requested_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
start_requested_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Start requested for %s'
%
self
.
computer
.
getTitle
()
)
self
.
start_requested_software_installation
.
validate
()
self
.
start_requested_software_installation
.
requestStart
()
self
.
destroy_requested_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
destroy_requested_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Destroy requested for %s'
%
self
.
computer
.
getTitle
()
)
self
.
destroy_requested_software_installation
.
validate
()
self
.
destroy_requested_software_installation
.
requestStart
()
self
.
destroy_requested_software_installation
.
requestDestroy
()
self
.
destroyed_software_installation
=
self
.
portal
.
software_installation_module
\
.
template_software_installation
.
Base_createCloneDocument
(
batch_mode
=
1
)
self
.
destroyed_software_installation
.
edit
(
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
aggregate
=
self
.
computer
.
getRelativeUrl
(),
reference
=
'TESTSOFTINST-%s'
%
self
.
generateNewId
(),
title
=
'Destroyed for %s'
%
self
.
computer
.
getTitle
()
)
self
.
destroyed_software_installation
.
validate
()
self
.
destroyed_software_installation
.
requestStart
()
self
.
destroyed_software_installation
.
requestDestroy
()
self
.
destroyed_software_installation
.
invalidate
()
self
.
computer
.
partition1
.
markBusy
()
self
.
computer
.
partition2
.
markBusy
()
self
.
computer
.
partition3
.
markBusy
()
# prepare some trees
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'started'
)
hosting_subscription
.
requestStart
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
self
.
start_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
start_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition1
.
getRelativeUrl
())
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
self
.
stop_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
stop_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition2
.
getRelativeUrl
()
)
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
kw
[
'state'
]
=
'destroyed'
hosting_subscription
.
requestDestroy
(
**
kw
)
self
.
destroy_requested_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
destroy_requested_software_instance
.
requestDestroy
(
**
kw
)
self
.
destroy_requested_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition3
.
getRelativeUrl
()
)
hosting_subscription
=
self
.
portal
.
hosting_subscription_module
\
.
template_hosting_subscription
.
Base_createCloneDocument
(
batch_mode
=
1
)
hosting_subscription
.
edit
(
)
hosting_subscription
.
validate
()
hosting_subscription
.
edit
(
title
=
self
.
generateNewSoftwareTitle
(),
reference
=
"TESTSI-%s"
%
self
.
generateNewId
(),
)
kw
=
dict
(
software_release
=
\
self
.
start_requested_software_installation
.
getUrlString
(),
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
False
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'stopped'
)
hosting_subscription
.
requestStop
(
**
kw
)
hosting_subscription
.
requestInstance
(
**
kw
)
kw
[
'state'
]
=
'destroyed'
hosting_subscription
.
requestDestroy
(
**
kw
)
self
.
destroyed_software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
destroyed_software_instance
.
edit
(
aggregate
=
self
.
computer
.
partition4
.
getRelativeUrl
()
)
self
.
destroyed_software_instance
.
requestDestroy
(
**
kw
)
self
.
destroyed_software_instance
.
invalidate
()
self
.
tic
()
self
.
_cleaupREQUEST
()
def
_cleaupREQUEST
(
self
):
self
.
portal
.
REQUEST
[
'request_instance'
]
=
None
self
.
portal
.
REQUEST
.
headers
=
{}
class
TestSlapOSDummy
(
testSlapOSMixin
):
class
TestSlapOSDummy
(
testSlapOSMixin
):
run_all_test
=
1
run_all_test
=
1
def
test
(
self
):
def
test
(
self
):
...
...
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