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
bf9c7507
Commit
bf9c7507
authored
Sep 29, 2022
by
Cédric Le Ninivin
Committed by
Romain Courteaud
Dec 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapgrid: Update tests and fix backward compatibility
parent
1bb9b92f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+1
-1
slapos/tests/test_slapgrid_slaptool.py
slapos/tests/test_slapgrid_slaptool.py
+21
-0
No files found.
slapos/grid/slapgrid.py
View file @
bf9c7507
...
@@ -601,7 +601,7 @@ stderr_logfile_backups=1
...
@@ -601,7 +601,7 @@ stderr_logfile_backups=1
parameter_dict
=
partition
.
getInstanceParameterDict
()
parameter_dict
=
partition
.
getInstanceParameterDict
()
self
.
computer_partition_list
.
append
({
self
.
computer_partition_list
.
append
({
"reference"
:
partition
.
_instance_guid
,
"reference"
:
getattr
(
partition
,
'_instance_guid'
,
None
)
,
"portal_type"
:
"Software Instance"
,
"portal_type"
:
"Software Instance"
,
"compute_partition_id"
:
partition
.
getId
(),
"compute_partition_id"
:
partition
.
getId
(),
"state"
:
partition
.
getState
(),
"state"
:
partition
.
getState
(),
...
...
slapos/tests/test_slapgrid_slaptool.py
View file @
bf9c7507
...
@@ -831,6 +831,7 @@ exit 1
...
@@ -831,6 +831,7 @@ exit 1
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/startedComputerPartition'
,
'/startedComputerPartition'
,
'/getHateoasUrl'
,
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/softwareInstanceError'
])
'/softwareInstanceError'
])
...
@@ -886,6 +887,7 @@ chmod 755 etc/run/wrapper
...
@@ -886,6 +887,7 @@ chmod 755 etc/run/wrapper
self
.
assertLogContent
(
wrapper_log
,
'Signal handler called with signal 15'
)
self
.
assertLogContent
(
wrapper_log
,
'Signal handler called with signal 15'
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'/getHateoasUrl'
,
[
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/stoppedComputerPartition'
])
'/stoppedComputerPartition'
])
...
@@ -951,6 +953,7 @@ exit 1
...
@@ -951,6 +953,7 @@ exit 1
self
.
assertLogContent
(
wrapper_log
,
'Signal handler called with signal 15'
)
self
.
assertLogContent
(
wrapper_log
,
'Signal handler called with signal 15'
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'/getHateoasUrl'
,
[
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/softwareInstanceError'
])
'/softwareInstanceError'
])
...
@@ -990,6 +993,7 @@ exit 1
...
@@ -990,6 +993,7 @@ exit 1
self
.
assertLogContent
(
wrapper_log
,
'Working'
)
self
.
assertLogContent
(
wrapper_log
,
'Working'
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'/getHateoasUrl'
,
[
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/startedComputerPartition'
])
'/startedComputerPartition'
])
...
@@ -1470,14 +1474,17 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
...
@@ -1470,14 +1474,17 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self
.
assertEqual
(
self
.
launchSlapgrid
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
launchSlapgrid
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'/getHateoasUrl'
,
[
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/stoppedComputerPartition'
,
'/stoppedComputerPartition'
,
'/getHateoasUrl'
,
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/stoppedComputerPartition'
,
'/stoppedComputerPartition'
,
'/getHateoasUrl'
,
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
])
'/getFullComputerInformation'
])
def
test_partition_timestamp_no_timestamp
(
self
):
def
test_partition_timestamp_no_timestamp
(
self
):
...
@@ -1498,10 +1505,12 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
...
@@ -1498,10 +1505,12 @@ class TestSlapgridCPPartitionProcessing(MasterMixin, unittest.TestCase):
self
.
launchSlapgrid
()
self
.
launchSlapgrid
()
self
.
assertEqual
(
computer
.
sequence
,
self
.
assertEqual
(
computer
.
sequence
,
[
'/getHateoasUrl'
,
[
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/stoppedComputerPartition'
,
'/stoppedComputerPartition'
,
'/getHateoasUrl'
,
'/getHateoasUrl'
,
'/getJIOAPIUrl'
,
'/getFullComputerInformation'
,
'/getFullComputerInformation'
,
'/getComputerPartitionCertificate'
,
'/getComputerPartitionCertificate'
,
'/stoppedComputerPartition'
])
'/stoppedComputerPartition'
])
...
@@ -1910,6 +1919,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1910,6 +1919,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
# Then destroy the instance
# Then destroy the instance
computer
.
sequence
=
[]
computer
.
sequence
=
[]
instance
.
requested_state
=
'destroyed'
instance
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is empty
# Assert partition directory is empty
self
.
assertInstanceDirectoryListEqual
([
'0'
])
self
.
assertInstanceDirectoryListEqual
([
'0'
])
...
@@ -1984,6 +1994,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
...
@@ -1984,6 +1994,7 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
# Then run usage report and see if it is still working
# Then run usage report and see if it is still working
computer
.
sequence
=
[]
computer
.
sequence
=
[]
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# registerComputerPartition will create one more file:
# registerComputerPartition will create one more file:
from
slapos.slap.slap
import
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME
from
slapos.slap.slap
import
COMPUTER_PARTITION_REQUEST_LIST_TEMPLATE_FILENAME
...
@@ -2397,6 +2408,7 @@ class TestSlapgridDestructionLock(MasterMixin, unittest.TestCase):
...
@@ -2397,6 +2408,7 @@ class TestSlapgridDestructionLock(MasterMixin, unittest.TestCase):
)))
)))
instance
.
requested_state
=
'destroyed'
instance
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
grid
.
agregateAndSendUsage
()
self
.
grid
.
agregateAndSendUsage
()
self
.
assertTrue
(
os
.
path
.
exists
(
dummy_instance_file_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
dummy_instance_file_path
))
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
self
.
assertTrue
(
os
.
path
.
exists
(
os
.
path
.
join
(
...
@@ -2858,6 +2870,7 @@ exit 0
...
@@ -2858,6 +2870,7 @@ exit 0
self
.
grid
.
_manager_list
=
manager_list
self
.
grid
.
_manager_list
=
manager_list
partition
.
requested_state
=
'destroyed'
partition
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is not destroyed (pre-delete is running)
# Assert partition directory is not destroyed (pre-delete is running)
self
.
assertInstanceDirectoryListEqual
([
'0'
])
self
.
assertInstanceDirectoryListEqual
([
'0'
])
...
@@ -2872,6 +2885,7 @@ exit 0
...
@@ -2872,6 +2885,7 @@ exit 0
# wait until the pre-delete script is finished
# wait until the pre-delete script is finished
self
.
_wait_prerm_script_finished
(
partition
.
partition_path
)
self
.
_wait_prerm_script_finished
(
partition
.
partition_path
)
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is empty
# Assert partition directory is empty
self
.
assertInstanceDirectoryListEqual
([
'0'
])
self
.
assertInstanceDirectoryListEqual
([
'0'
])
...
@@ -2902,6 +2916,7 @@ exit 0
...
@@ -2902,6 +2916,7 @@ exit 0
self
.
grid
.
_manager_list
=
manager_list
self
.
grid
.
_manager_list
=
manager_list
partition
.
requested_state
=
'destroyed'
partition
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is not destroyed (retention-delay-lock)
# Assert partition directory is not destroyed (retention-delay-lock)
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
...
@@ -2915,6 +2930,7 @@ exit 0
...
@@ -2915,6 +2930,7 @@ exit 0
)))
)))
time
.
sleep
(
1
)
time
.
sleep
(
1
)
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is not destroyed (pre-delete is running)
# Assert partition directory is not destroyed (pre-delete is running)
...
@@ -2927,6 +2943,7 @@ exit 0
...
@@ -2927,6 +2943,7 @@ exit 0
# wait until the pre-delete script is finished
# wait until the pre-delete script is finished
self
.
_wait_prerm_script_finished
(
partition
.
partition_path
)
self
.
_wait_prerm_script_finished
(
partition
.
partition_path
)
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is empty
# Assert partition directory is empty
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
[])
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
[])
...
@@ -2948,6 +2965,7 @@ exit 0
...
@@ -2948,6 +2965,7 @@ exit 0
self
.
grid
.
_manager_list
=
manager_list
self
.
grid
.
_manager_list
=
manager_list
partition
.
requested_state
=
'destroyed'
partition
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is not destroyed (pre-delete is running)
# Assert partition directory is not destroyed (pre-delete is running)
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
...
@@ -2961,6 +2979,7 @@ exit 0
...
@@ -2961,6 +2979,7 @@ exit 0
# the script is well finished...
# the script is well finished...
self
.
assertTrue
(
"finished prerm script."
in
f
.
read
())
self
.
assertTrue
(
"finished prerm script."
in
f
.
read
())
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is empty
# Assert partition directory is empty
self
.
assertInstanceDirectoryListEqual
([
'0'
])
self
.
assertInstanceDirectoryListEqual
([
'0'
])
...
@@ -2983,6 +3002,7 @@ exit 0
...
@@ -2983,6 +3002,7 @@ exit 0
self
.
grid
.
_manager_list
=
manager_list
self
.
grid
.
_manager_list
=
manager_list
partition
.
requested_state
=
'destroyed'
partition
.
requested_state
=
'destroyed'
self
.
grid
.
computer
.
_synced
=
False
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
self
.
assertEqual
(
self
.
grid
.
agregateAndSendUsage
(),
slapgrid
.
SLAPGRID_SUCCESS
)
# Assert partition directory is not destroyed (pre-delete is running)
# Assert partition directory is not destroyed (pre-delete is running)
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
six
.
assertCountEqual
(
self
,
os
.
listdir
(
partition
.
partition_path
),
...
@@ -3013,6 +3033,7 @@ exit 0
...
@@ -3013,6 +3033,7 @@ exit 0
# wait until the pre-delete script is finished
# wait until the pre-delete script is finished
self._wait_prerm_script_finished(partition.partition_path)
self._wait_prerm_script_finished(partition.partition_path)
self.grid.computer._synced = False
self.assertEqual(self.grid.agregateAndSendUsage(), slapgrid.SLAPGRID_SUCCESS)
self.assertEqual(self.grid.agregateAndSendUsage(), slapgrid.SLAPGRID_SUCCESS)
# Assert partition directory is empty
# Assert partition directory is empty
self.assertInstanceDirectoryListEqual(['0'])
self.assertInstanceDirectoryListEqual(['0'])
...
...
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