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
5098fa75
Commit
5098fa75
authored
May 23, 2022
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_erp5: duplicate test_default_scenario to happily break it
parent
0c3890bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
261 additions
and
0 deletions
+261
-0
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
...tal_components/test.erp5.testSlapOSERP5DefaultScenario.py
+261
-0
No files found.
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5DefaultScenario.py
View file @
5098fa75
...
@@ -11,6 +11,267 @@ import re
...
@@ -11,6 +11,267 @@ import re
class
TestSlapOSDefaultScenario
(
DefaultScenarioMixin
):
class
TestSlapOSDefaultScenario
(
DefaultScenarioMixin
):
def
test_new_default_scenatio
(
self
):
# some preparation
self
.
logout
()
self
.
web_site
=
self
.
portal
.
web_site_module
.
hostingjs
# lets join as owner, which will own few compute_nodes
owner_reference
=
'owner-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
owner_reference
)
self
.
login
()
owner_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
owner_reference
).
getParentValue
()
# hooray, now it is time to create compute_nodes
self
.
login
(
owner_person
.
getUserId
())
public_server_title
=
'Public Server for %s'
%
owner_reference
public_server_id
=
self
.
requestComputeNode
(
public_server_title
)
public_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
public_server_id
)
self
.
setAccessToMemcached
(
public_server
)
self
.
assertNotEqual
(
None
,
public_server
)
self
.
setServerOpenPublic
(
public_server
)
personal_server_title
=
'Personal Server for %s'
%
owner_reference
personal_server_id
=
self
.
requestComputeNode
(
personal_server_title
)
personal_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
personal_server_id
)
self
.
assertNotEqual
(
None
,
personal_server
)
self
.
setServerOpenPersonal
(
personal_server
)
friend_server_title
=
'Friend Server for %s'
%
owner_reference
friend_server_id
=
self
.
requestComputeNode
(
friend_server_title
)
friend_server
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Compute Node'
,
reference
=
friend_server_id
)
self
.
assertNotEqual
(
None
,
friend_server
)
self
.
setServerOpenFriend
(
friend_server
)
# and install some software on them
public_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
supplySoftware
(
public_server
,
public_server_software
)
personal_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
supplySoftware
(
personal_server
,
personal_server_software
)
friend_server_software
=
self
.
generateNewSoftwareReleaseUrl
()
self
.
supplySoftware
(
friend_server
,
friend_server_software
)
# format the compute_nodes
self
.
formatComputeNode
(
public_server
)
self
.
formatComputeNode
(
personal_server
)
self
.
formatComputeNode
(
friend_server
)
# join as the another visitor and request software instance on public
# compute_node
self
.
logout
()
public_reference
=
'public-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
"ERP5 Login"
,
reference
=
public_reference
).
getParentValue
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_type
=
'public type'
self
.
checkInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
public_server
)
# join as owner friend and request a software instance on compute_node
# configured by owner
self
.
logout
()
friend_reference
=
'friend-%s'
%
self
.
generateNewId
()
self
.
joinSlapOS
(
self
.
web_site
,
friend_reference
)
self
.
login
()
friend_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
friend_reference
).
getParentValue
()
friend_email
=
friend_person
.
getDefaultEmailText
()
# allow friend to alloce on friendly compute_node
self
.
login
(
owner_person
.
getUserId
())
self
.
setServerOpenFriend
(
friend_server
,
[
friend_email
])
friend_instance_title
=
'Friend title %s'
%
self
.
generateNewId
()
friend_instance_type
=
'friend_type'
self
.
checkInstanceAllocation
(
friend_person
.
getUserId
(),
friend_reference
,
friend_instance_title
,
friend_server_software
,
friend_instance_type
,
friend_server
)
# check that friend is able to request slave instance matching the
# public's compute_node software instance
friend_slave_instance_title
=
'Friend slave title %s'
%
self
.
\
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
friend_person
.
getUserId
(),
friend_reference
,
friend_slave_instance_title
,
public_server_software
,
public_instance_type
,
public_server
)
# turn public guy to a friend and check that he can allocate slave
# instance on instance provided by friend
self
.
login
()
public_person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
public_reference
).
getParentValue
()
public_email
=
public_person
.
getDefaultEmailText
()
self
.
login
(
owner_person
.
getUserId
())
self
.
setServerOpenFriend
(
friend_server
,
[
friend_email
,
public_email
])
public_slave_instance_title
=
'Public slave title %s'
%
self
\
.
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
public_person
.
getUserId
(),
public_reference
,
public_slave_instance_title
,
friend_server_software
,
friend_instance_type
,
friend_server
)
# now deallocate the slaves
self
.
checkSlaveInstanceUnallocation
(
public_person
.
getUserId
(),
public_reference
,
public_slave_instance_title
,
friend_server_software
,
friend_instance_type
,
friend_server
)
self
.
checkSlaveInstanceUnallocation
(
friend_person
.
getUserId
(),
friend_reference
,
friend_slave_instance_title
,
public_server_software
,
public_instance_type
,
public_server
)
# and the instances
self
.
checkInstanceUnallocation
(
public_person
.
getUserId
(),
public_reference
,
public_instance_title
,
public_server_software
,
public_instance_type
,
public_server
)
self
.
checkInstanceUnallocation
(
friend_person
.
getUserId
(),
friend_reference
,
friend_instance_title
,
friend_server_software
,
friend_instance_type
,
friend_server
)
# and uninstall some software on them
self
.
logout
()
self
.
login
(
owner_person
.
getUserId
())
self
.
supplySoftware
(
public_server
,
public_server_software
,
state
=
'destroyed'
)
self
.
supplySoftware
(
personal_server
,
personal_server_software
,
state
=
'destroyed'
)
self
.
supplySoftware
(
friend_server
,
friend_server_software
,
state
=
'destroyed'
)
self
.
logout
()
# Uninstall from compute_node
self
.
login
()
self
.
simulateSlapgridSR
(
public_server
)
self
.
simulateSlapgridSR
(
personal_server
)
self
.
simulateSlapgridSR
(
friend_server
)
# check the Open Sale Order coverage
self
.
stepCallSlaposRequestUpdateInstanceTreeOpenSaleOrderAlarm
()
self
.
tic
()
self
.
login
()
self
.
assertOpenSaleOrderCoverage
(
owner_reference
)
self
.
assertOpenSaleOrderCoverage
(
friend_reference
)
self
.
assertOpenSaleOrderCoverage
(
public_reference
)
# generate simulation for open order
self
.
stepCallUpdateOpenOrderSimulationAlarm
()
self
.
tic
()
# build subscription packing list
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
# stabilise build deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# build aggregated packing list
self
.
stepCallSlaposTriggerAggregatedDeliveryOrderBuilderAlarm
()
self
.
tic
()
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# start aggregated deliveries
self
.
stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm
(
accounting_date
=
DateTime
(
'2222/01/01'
))
self
.
tic
()
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# deliver aggregated deliveries
self
.
stepCallSlaposDeliverStartedAggregatedSalePackingListAlarm
()
self
.
tic
()
# stabilise aggregated deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# build aggregated invoices
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
# stabilise aggregated invoices and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# update invoices with their tax & discount
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# update invoices with their tax & discount transaction lines
self
.
stepCallSlaposTriggerBuildAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# stop the invoices and solve them again
self
.
stepCallSlaposStopConfirmedAggregatedSaleInvoiceTransactionAlarm
()
self
.
tic
()
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
builder
=
self
.
portal
.
portal_orders
.
slapos_payment_transaction_builder
for
_
in
range
(
500
):
# build the aggregated payment
self
.
stepCallSlaposTriggerPaymentTransactionOrderBuilderAlarm
()
self
.
tic
()
# If there is something unbuild recall alarm.
if
len
(
builder
.
OrderBuilder_generateUnrelatedInvoiceList
()):
break
# start the payzen payment
self
.
stepCallSlaposPayzenUpdateConfirmedPaymentAlarm
()
self
.
tic
()
# stabilise the payment deliveries and expand them
self
.
stepCallSlaposManageBuildingCalculatingDeliveryAlarm
()
self
.
tic
()
# trigger the CRM interaction
self
.
stepCallSlaposCrmCreateRegularisationRequestAlarm
()
self
.
tic
()
# check final document state
for
person_reference
in
(
owner_reference
,
friend_reference
,
public_reference
):
person
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'ERP5 Login'
,
reference
=
person_reference
).
getParentValue
()
self
.
assertPersonDocumentCoverage
(
person
)
self
.
login
(
public_person
.
getUserId
())
self
.
usePayzenManually
(
self
.
web_site
,
public_person
.
getUserId
())
self
.
login
(
friend_person
.
getUserId
())
self
.
usePayzenManually
(
self
.
web_site
,
friend_person
.
getUserId
())
def
test_default_scenario
(
self
):
def
test_default_scenario
(
self
):
# some preparation
# some preparation
self
.
logout
()
self
.
logout
()
...
...
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