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
Labels
Merge Requests
21
Merge Requests
21
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos.core
Commits
4b61347e
Commit
4b61347e
authored
Aug 28, 2019
by
Łukasz Nowak
Committed by
Rafael Monnerat
Aug 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_pdm: Test HostingSubscription_createUpgradeDecision
parent
58ab7ea3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
272 additions
and
1 deletion
+272
-1
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMUpgradeDecisionSkins.py
...components/test.erp5.testSlapOSPDMUpgradeDecisionSkins.py
+147
-0
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMUpgradeDecisionSkins.xml
...omponents/test.erp5.testSlapOSPDMUpgradeDecisionSkins.xml
+123
-0
master/bt5/slapos_pdm/bt/template_test_id_list
master/bt5/slapos_pdm/bt/template_test_id_list
+2
-1
No files found.
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMUpgradeDecisionSkins.py
0 → 100644
View file @
4b61347e
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
##############################################################################
from
erp5.component.test.SlapOSTestCaseMixin
import
SlapOSTestCaseMixin
from
DateTime
import
DateTime
class
TestSlapOSPDMUpgradeDecisionSkins
(
SlapOSTestCaseMixin
):
def
_makeSoftwareProductCatalog
(
self
):
self
.
software_product
=
self
.
_makeSoftwareProduct
(
self
.
generateNewId
())
self
.
previous_software_release
=
self
.
_makeSoftwareRelease
(
self
.
generateNewId
())
self
.
new_software_release
=
self
.
_makeSoftwareRelease
(
self
.
generateNewId
())
self
.
previous_software_release
.
publish
()
self
.
new_software_release
.
publish
()
self
.
previous_software_release
.
edit
(
aggregate
=
self
.
software_product
.
getRelativeUrl
(),
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
version
=
'1'
,
effective_date
=
DateTime
()
-
1
,
)
self
.
new_software_release
.
edit
(
aggregate
=
self
.
software_product
.
getRelativeUrl
(),
url_string
=
self
.
generateNewSoftwareReleaseUrl
(),
version
=
'2'
,
effective_date
=
DateTime
(),
)
self
.
tic
()
def
_installSoftwareOnTheComputer
(
self
,
software_release_url_list
):
for
software_release
in
software_release_url_list
:
software_installation
=
self
.
portal
.
software_installation_module
\
.
newContent
(
portal_type
=
'Software Installation'
,
url_string
=
software_release
,
aggregate
=
self
.
computer
.
getRelativeUrl
())
software_installation
.
validate
()
software_installation
.
requestStart
()
self
.
tic
()
def
_createInstance
(
self
,
url_string
,
shared
=
False
):
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
=
"TESTHS-%s"
%
self
.
generateNewId
(),
destination_section_value
=
self
.
person
)
request_kw
=
dict
(
software_release
=
url_string
,
software_type
=
self
.
generateNewSoftwareType
(),
instance_xml
=
self
.
generateSafeXml
(),
sla_xml
=
self
.
generateSafeXml
(),
shared
=
shared
,
software_title
=
hosting_subscription
.
getTitle
(),
state
=
'started'
)
hosting_subscription
.
requestStart
(
**
request_kw
)
hosting_subscription
.
requestInstance
(
**
request_kw
)
instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
tic
()
return
hosting_subscription
,
instance
def
_makeTree
(
self
,
software_release_url
):
self
.
hosting_subscription
,
self
.
instance
=
self
.
_createInstance
(
software_release_url
)
self
.
shared_hosting_subscription
,
self
.
shared_instance
=
self
.
_createInstance
(
software_release_url
,
True
)
self
.
instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
shared_instance
.
setAggregate
(
self
.
partition
.
getRelativeUrl
())
self
.
partition
.
markBusy
()
self
.
tic
()
def
afterSetUp
(
self
):
SlapOSTestCaseMixin
.
afterSetUp
(
self
)
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
preference
.
setPreferredCloudContractEnabled
(
True
)
self
.
tic
()
self
.
_makeComputer
()
self
.
_makeSoftwareProductCatalog
()
self
.
_installSoftwareOnTheComputer
([
self
.
previous_software_release
.
getUrlString
(),
self
.
new_software_release
.
getUrlString
()
])
self
.
person
=
self
.
makePerson
()
self
.
tic
()
self
.
_makeTree
(
self
.
previous_software_release
.
getUrlString
())
def
test_HostingSubscription_createUpgradeDecision_upgradeScopeConfirmation
(
self
):
# check upgrade decision on HS
self
.
hosting_subscription
.
setUpgradeScope
(
'manual'
)
self
.
tic
()
upgrade_decision
=
self
.
hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
'planned'
,
upgrade_decision
.
getSimulationState
())
shared_upgrade_decision
=
self
.
shared_hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
None
,
shared_upgrade_decision
)
# simulate upgrade of the hosting subscription
upgrade_decision
.
confirm
()
upgrade_decision
.
start
()
upgrade_decision
.
stop
()
upgrade_decision
.
deliver
()
self
.
hosting_subscription
.
edit
(
url_string
=
self
.
new_software_release
.
getUrlString
())
self
.
instance
.
edit
(
url_string
=
self
.
new_software_release
.
getUrlString
())
self
.
tic
()
# check upgrade decision on shared HS related to upgraded HS
self
.
shared_hosting_subscription
.
setUpgradeScope
(
'manual'
)
shared_upgrade_decision
=
self
.
shared_hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
shared_upgrade_decision
.
getSimulationState
())
def
test_HostingSubscription_createUpgradeDecision_upgradeScopeAuto
(
self
):
# check upgrade decision on HS
self
.
hosting_subscription
.
setUpgradeScope
(
'auto'
)
self
.
tic
()
upgrade_decision
=
self
.
hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
upgrade_decision
.
getSimulationState
())
shared_upgrade_decision
=
self
.
shared_hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
None
,
shared_upgrade_decision
)
# simulate upgrade of the hosting subscription
upgrade_decision
.
stop
()
upgrade_decision
.
deliver
()
self
.
hosting_subscription
.
edit
(
url_string
=
self
.
new_software_release
.
getUrlString
())
self
.
instance
.
edit
(
url_string
=
self
.
new_software_release
.
getUrlString
())
self
.
tic
()
# check upgrade decision on shared HS related to upgraded HS
self
.
shared_hosting_subscription
.
setUpgradeScope
(
'auto'
)
shared_upgrade_decision
=
self
.
shared_hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
'started'
,
shared_upgrade_decision
.
getSimulationState
())
def
test_HostingSubscription_createUpgradeDecision_upgradeScopeDisabled
(
self
):
# check upgrade decision on HS
self
.
hosting_subscription
.
setUpgradeScope
(
'disabled'
)
self
.
tic
()
upgrade_decision
=
self
.
hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
None
,
upgrade_decision
)
shared_upgrade_decision
=
self
.
shared_hosting_subscription
.
HostingSubscription_createUpgradeDecision
()
self
.
assertEqual
(
None
,
shared_upgrade_decision
)
\ No newline at end of file
master/bt5/slapos_pdm/TestTemplateItem/portal_components/test.erp5.testSlapOSPDMUpgradeDecisionSkins.xml
0 → 100644
View file @
4b61347e
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"Test Component"
module=
"erp5.portal_type"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
_recorded_property_dict
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
testSlapOSPDMUpgradeDecisionSkins
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
test.erp5.testSlapOSPDMUpgradeDecisionSkins
</string>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Test Component
</string>
</value>
</item>
<item>
<key>
<string>
sid
</string>
</key>
<value>
<none/>
</value>
</item>
<item>
<key>
<string>
text_content_error_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
version
</string>
</key>
<value>
<string>
erp5
</string>
</value>
</item>
<item>
<key>
<string>
workflow_history
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAM=
</string>
</persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"3"
aka=
"AAAAAAAAAAM="
>
<pickle>
<global
name=
"PersistentMapping"
module=
"Persistence.mapping"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
data
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
component_validation_workflow
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAQ=
</string>
</persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"4"
aka=
"AAAAAAAAAAQ="
>
<pickle>
<global
name=
"WorkflowHistoryList"
module=
"Products.ERP5Type.patches.WorkflowTool"
/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
validate
</string>
</value>
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
validated
</string>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
</record>
</ZopeData>
master/bt5/slapos_pdm/bt/template_test_id_list
View file @
4b61347e
test.erp5.testSlapOSPDMAlarm
test.erp5.testSlapOSPDMAlarm
test.erp5.testSlapOSPDMSkins
test.erp5.testSlapOSPDMSkins
test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm
test.erp5.testSlapOSPDMDestroySoftwareInstallationWithArchivedSoftwareReleaseAlarm
\ No newline at end of file
test.erp5.testSlapOSPDMUpgradeDecisionSkins
\ 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