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
0
Merge Requests
0
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
Rafael Monnerat
slapos.core
Commits
058d9165
Commit
058d9165
authored
Nov 09, 2012
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checkpoint: assert Slave Instance allocation.
parent
3b4454e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
6 deletions
+91
-6
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSDefaultScenario.py
...slapos_erp5/TestTemplateItem/testSlapOSDefaultScenario.py
+90
-5
master/bt5/slapos_erp5/bt/revision
master/bt5/slapos_erp5/bt/revision
+1
-1
No files found.
master/bt5/slapos_erp5/TestTemplateItem/testSlapOSDefaultScenario.py
View file @
058d9165
...
@@ -126,6 +126,7 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -126,6 +126,7 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
def
WebSection_getCurrentHostingSubscriptionList
(
self
):
def
WebSection_getCurrentHostingSubscriptionList
(
self
):
return
self
.
web_site
.
hosting
.
myspace
.
my_services
\
return
self
.
web_site
.
hosting
.
myspace
.
my_services
\
.
WebSection_getCurrentHostingSubscriptionList
()
.
WebSection_getCurrentHostingSubscriptionList
()
def
formatComputer
(
self
,
computer
,
partition_count
=
10
):
def
formatComputer
(
self
,
computer
,
partition_count
=
10
):
computer_dict
=
dict
(
computer_dict
=
dict
(
software_root
=
'/opt'
,
software_root
=
'/opt'
,
...
@@ -181,6 +182,19 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -181,6 +182,19 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
computer_partition_id
=
partition
.
_partition_id
,
computer_partition_id
=
partition
.
_partition_id
,
connection_xml
=
connection_xml
connection_xml
=
connection_xml
)
)
for
slave
in
partition
.
_parameter_dict
[
'slave_instance_list'
]:
slave_reference
=
slave
[
'slave_reference'
]
connection_xml
=
xml_marshaller
.
xml_marshaller
.
dumps
(
dict
(
url_1
=
'http://%s/%s'
%
(
ip_list
[
0
][
1
],
slave_reference
),
url_2
=
'http://%s/%s'
%
(
ip_list
[
1
][
1
],
slave_reference
)
))
self
.
portal
.
portal_slap
.
setComputerPartitionConnectionXml
(
computer_id
=
computer_reference
,
computer_partition_id
=
partition
.
_partition_id
,
connection_xml
=
connection_xml
,
slave_reference
=
slave_reference
)
finally
:
finally
:
setSecurityManager
(
oldsm
)
setSecurityManager
(
oldsm
)
finally
:
finally
:
...
@@ -200,6 +214,51 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -200,6 +214,51 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self
.
assertEqual
(
'SoftwareInstance'
,
software_instance
.
__class__
.
__name__
)
self
.
assertEqual
(
'SoftwareInstance'
,
software_instance
.
__class__
.
__name__
)
return
software_instance
return
software_instance
def
checkSlaveInstanceAllocation
(
self
,
person_reference
,
instance_title
,
software_release
,
software_type
,
server
):
self
.
login
(
person_reference
)
self
.
personRequestInstanceNotReady
(
software_release
=
software_release
,
software_type
=
software_type
,
partition_reference
=
instance_title
,
shared_xml
=
'<marshal><bool>1</bool></marshal>'
)
self
.
stepCallSlaposAllocateInstanceAlarm
()
self
.
tic
()
self
.
personRequestInstance
(
software_release
=
software_release
,
software_type
=
software_type
,
partition_reference
=
instance_title
,
shared_xml
=
'<marshal><bool>1</bool></marshal>'
)
# now instantiate it on computer and set some nice connection dict
self
.
simulateSlapgridCP
(
server
)
# let's find instances of user and check connection strings
hosting_subscription_list
=
[
q
.
getObject
()
for
q
in
self
.
WebSection_getCurrentHostingSubscriptionList
()
if
q
.
getTitle
()
==
instance_title
]
self
.
assertEqual
(
1
,
len
(
hosting_subscription_list
))
hosting_subscription
=
hosting_subscription_list
[
0
]
software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
assertEqual
(
software_instance
.
getTitle
(),
hosting_subscription
.
getTitle
())
connection_dict
=
software_instance
.
getConnectionXmlAsDict
()
self
.
assertSameSet
((
'url_1'
,
'url_2'
),
connection_dict
.
keys
())
self
.
login
()
partition
=
software_instance
.
getAggregateValue
()
self
.
assertSameSet
(
[
'http://%s/%s'
%
(
q
.
getIpAddress
(),
software_instance
.
getReference
())
for
q
in
partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
)],
connection_dict
.
values
())
def
checkInstanceAllocation
(
self
,
person_reference
,
instance_title
,
def
checkInstanceAllocation
(
self
,
person_reference
,
instance_title
,
software_release
,
software_type
,
server
):
software_release
,
software_type
,
server
):
...
@@ -223,10 +282,11 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -223,10 +282,11 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self
.
simulateSlapgridCP
(
server
)
self
.
simulateSlapgridCP
(
server
)
# let's find instances of user and check connection strings
# let's find instances of user and check connection strings
hosting_subscription_list
=
self
.
\
hosting_subscription_list
=
[
q
.
getObject
()
for
q
in
WebSection_getCurrentHostingSubscriptionList
()
self
.
WebSection_getCurrentHostingSubscriptionList
()
if
q
.
getTitle
()
==
instance_title
]
self
.
assertEqual
(
1
,
len
(
hosting_subscription_list
))
self
.
assertEqual
(
1
,
len
(
hosting_subscription_list
))
hosting_subscription
=
hosting_subscription_list
[
0
]
.
getObject
()
hosting_subscription
=
hosting_subscription_list
[
0
]
software_instance
=
hosting_subscription
.
getPredecessorValue
()
software_instance
=
hosting_subscription
.
getPredecessorValue
()
self
.
assertEqual
(
software_instance
.
getTitle
(),
self
.
assertEqual
(
software_instance
.
getTitle
(),
...
@@ -295,8 +355,9 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -295,8 +355,9 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
self
.
joinSlapOS
(
self
.
web_site
,
public_reference
)
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_title
=
'Public title %s'
%
self
.
generateNewId
()
public_instance_type
=
'public type'
self
.
checkInstanceAllocation
(
public_reference
,
public_instance_title
,
self
.
checkInstanceAllocation
(
public_reference
,
public_instance_title
,
public_server_software
,
'public type'
,
public_server
)
public_server_software
,
public_instance_type
,
public_server
)
# join as owner friend and request a software instance on computer
# join as owner friend and request a software instance on computer
# configured by owner
# configured by owner
...
@@ -313,8 +374,32 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
...
@@ -313,8 +374,32 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self
.
setServerOpenFriend
(
friend_server
,
[
friend_email
])
self
.
setServerOpenFriend
(
friend_server
,
[
friend_email
])
friend_instance_title
=
'Friend title %s'
%
self
.
generateNewId
()
friend_instance_title
=
'Friend title %s'
%
self
.
generateNewId
()
friend_instance_type
=
'friend_type'
self
.
checkInstanceAllocation
(
friend_reference
,
friend_instance_title
,
self
.
checkInstanceAllocation
(
friend_reference
,
friend_instance_title
,
friend_server_software
,
'friend_type'
,
friend_server
)
friend_server_software
,
friend_instance_type
,
friend_server
)
# check that friend is able to request slave instance matching the
# public's computer software instance
friend_slave_instance_title
=
'Friend slave title %s'
%
self
.
\
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
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_email
=
self
.
portal
.
portal_catalog
.
getResultValue
(
portal_type
=
'Person'
,
reference
=
public_reference
).
getDefaultEmailText
()
self
.
login
(
owner_reference
)
self
.
setServerOpenFriend
(
friend_server
,
[
friend_email
,
public_email
])
public_slave_instance_title
=
'Public slave titmle %s'
%
self
\
.
generateNewId
()
self
.
checkSlaveInstanceAllocation
(
public_reference
,
public_slave_instance_title
,
friend_server_software
,
friend_instance_type
,
friend_server
)
# remove the assertion after test is finished
# remove the assertion after test is finished
self
.
assertTrue
(
False
,
'Test not finished'
)
self
.
assertTrue
(
False
,
'Test not finished'
)
master/bt5/slapos_erp5/bt/revision
View file @
058d9165
72
73
\ 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