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
56fa38cd
Commit
56fa38cd
authored
Jan 02, 2025
by
Romain Courteaud
🐙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_json_rpc_api: 2 tests
parent
08d1e9e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
104 additions
and
42 deletions
+104
-42
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
...lateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
+104
-42
No files found.
master/bt5/slapos_json_rpc_api/TestTemplateItem/portal_components/test.erp5.testSlapOSJsonRpc.py
View file @
56fa38cd
...
...
@@ -1399,52 +1399,114 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
self
.
start_requested_software_instance
.
getSuccessorTitleList
())
def
test_InstanceAccess_26_stoppedComputePartition
(
self
):
# XXX Should reported_state added to Instance returned json?
self
.
_makeComplexComputeNode
(
self
.
project
)
instance
=
self
.
start_requested_software_instance
self
.
login
(
instance
.
getUserId
())
self
.
callInstancePutToApiAndCheck
({
"reference"
:
instance
.
getReference
(),
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"stopped"
,
})
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance"
,
{
"portal_type"
:
"Software Instance"
,
"reference"
:
instance
.
getReference
(),
})
instance_dict
=
json
.
loads
(
response
.
getBody
())
self
.
assertEqual
(
instance_dict
[
"access_status_message"
],
"#access Instance correctly stopped"
)
self
.
assertEqual
(
instance_dict
[
"state"
],
"started"
with
PinnedDateTime
(
self
,
DateTime
(
'2020/05/19'
)):
# XXX Should reported_state added to Instance returned json?
self
.
_makeComplexComputeNode
(
self
.
project
)
instance
=
self
.
start_requested_software_instance
response
=
self
.
callJsonRpcWebService
(
"slapos.put.slapos_jio_api_put_software_instance"
,
{
"reference"
:
instance
.
getReference
(),
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"stopped"
},
instance
.
getUserId
()
)
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
self
.
assertEqual
({
'reference'
:
instance
.
getReference
(),
'date'
:
'2020-05-19T00:00:00+00:00'
,
'portal_type'
:
'Software Instance'
,
'success'
:
'Done'
},
byteify
(
json
.
loads
(
response
.
getBody
())))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
# Check get return the expected results after
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance"
,
{
"portal_type"
:
"Software Instance"
,
"reference"
:
instance
.
getReference
(),
},
instance
.
getUserId
()
)
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
self
.
assertEqual
({
'access_status_message'
:
"#access Instance correctly stopped"
,
"compute_node_id"
:
partition
.
getParentValue
().
getReference
(),
"compute_partition_id"
:
partition
.
getReference
(),
'full_ip_list'
:
[],
'ip_list'
:
[[
''
,
'ip_address_1'
]],
'portal_type'
:
'Software Instance'
,
'processing_timestamp'
:
1589846400000000
,
'reference'
:
instance
.
getReference
(),
'root_instance_title'
:
instance
.
getSpecialiseTitle
(),
'shared'
:
False
,
"sla_parameters"
:
instance
.
getSlaXmlAsDict
(),
"parameters"
:
instance
.
getInstanceXmlAsDict
(),
"connection_parameters"
:
instance
.
getConnectionXmlAsDict
(),
'software_release_uri'
:
instance
.
getUrlString
(),
'software_type'
:
instance
.
getSourceReference
(),
'state'
:
'started'
,
'title'
:
instance
.
getTitle
()
},
byteify
(
json
.
loads
(
response
.
getBody
())))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
def
test_InstanceAccess_27_startedComputePartition
(
self
):
# XXX Should reported_state added to Instance returned json?
self
.
_makeComplexComputeNode
(
self
.
project
)
instance
=
self
.
start_requested_software_instance
self
.
login
(
instance
.
getUserId
())
self
.
callInstancePutToApiAndCheck
({
"reference"
:
instance
.
getReference
(),
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"started"
,
})
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance"
,
{
"portal_type"
:
"Software Instance"
,
"reference"
:
instance
.
getReference
(),
})
instance_dict
=
json
.
loads
(
response
.
getBody
())
self
.
assertEqual
(
instance_dict
[
"access_status_message"
],
"#access Instance correctly started"
)
self
.
assertEqual
(
instance_dict
[
"state"
],
"started"
with
PinnedDateTime
(
self
,
DateTime
(
'2020/05/19'
)):
# XXX Should reported_state added to Instance returned json?
self
.
_makeComplexComputeNode
(
self
.
project
)
instance
=
self
.
start_requested_software_instance
response
=
self
.
callJsonRpcWebService
(
"slapos.put.slapos_jio_api_put_software_instance"
,
{
"reference"
:
instance
.
getReference
(),
"portal_type"
:
"Software Instance"
,
"reported_state"
:
"started"
},
instance
.
getUserId
()
)
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
self
.
assertEqual
({
'reference'
:
instance
.
getReference
(),
'date'
:
'2020-05-19T00:00:00+00:00'
,
'portal_type'
:
'Software Instance'
,
'success'
:
'Done'
},
byteify
(
json
.
loads
(
response
.
getBody
())))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
# Check get return the expected results after
response
=
self
.
callJsonRpcWebService
(
"slapos.get.slapos_jio_api_get_software_instance"
,
{
"portal_type"
:
"Software Instance"
,
"reference"
:
instance
.
getReference
(),
},
instance
.
getUserId
()
)
self
.
assertEqual
(
'application/json'
,
response
.
headers
.
get
(
'content-type'
))
partition
=
instance
.
getAggregateValue
(
portal_type
=
"Compute Partition"
)
self
.
assertEqual
({
'access_status_message'
:
"#access Instance correctly started"
,
"compute_node_id"
:
partition
.
getParentValue
().
getReference
(),
"compute_partition_id"
:
partition
.
getReference
(),
'full_ip_list'
:
[],
'ip_list'
:
[[
''
,
'ip_address_1'
]],
'portal_type'
:
'Software Instance'
,
'processing_timestamp'
:
1589846400000000
,
'reference'
:
instance
.
getReference
(),
'root_instance_title'
:
instance
.
getSpecialiseTitle
(),
'shared'
:
False
,
"sla_parameters"
:
instance
.
getSlaXmlAsDict
(),
"parameters"
:
instance
.
getInstanceXmlAsDict
(),
"connection_parameters"
:
instance
.
getConnectionXmlAsDict
(),
'software_release_uri'
:
instance
.
getUrlString
(),
'software_type'
:
instance
.
getSourceReference
(),
'state'
:
'started'
,
'title'
:
instance
.
getTitle
()
},
byteify
(
json
.
loads
(
response
.
getBody
())))
self
.
assertEqual
(
response
.
getStatus
(),
200
)
class
TestSlapOSSlapToolPersonAccess
(
TestSlapOSJsonRpcMixin
):
...
...
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