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
0
Merge Requests
0
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
Hardik Juneja
slapos.core
Commits
11cae9b7
Commit
11cae9b7
authored
Sep 25, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add slapgrid tests about destroyed partitions
parent
71506114
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+46
-1
No files found.
slapos/tests/slapgrid.py
View file @
11cae9b7
...
...
@@ -393,7 +393,7 @@ class TestSlapgridCPWithMaster(MasterMixin, unittest.TestCase):
def
test_one_free_partition
(
self
):
"""
Test if slapgrid don't process "free" partition
Test if slapgrid
cp
don't process "free" partition
"""
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
,
software_amount
=
0
)
...
...
@@ -540,6 +540,34 @@ chmod 755 etc/run/wrapper
'startedComputerPartition'
])
self
.
assertEqual
(
'started'
,
instance
.
state
)
def
test_one_partition_destroyed
(
self
):
"""
Test that an existing partition with "destroyed" status will only be
stopped by slapgrid-cp, not processed
"""
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
instance
=
computer
.
instance_list
[
0
]
instance
.
requested_state
=
'destroyed'
dummy_file_name
=
'dummy_file'
dummy_file
=
open
(
os
.
path
.
join
(
instance
.
partition_path
,
dummy_file_name
),
'w'
)
dummy_file
.
write
(
'dummy'
)
dummy_file
.
close
()
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
'var'
])
partition
=
os
.
path
.
join
(
self
.
instance_root
,
'0'
)
self
.
assertSortedListEqual
(
os
.
listdir
(
partition
),
[
dummy_file_name
])
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
,
'stoppedComputerPartition'
])
self
.
assertEqual
(
'stopped'
,
instance
.
state
)
class
TestSlapgridCPPartitionProcessing
(
MasterMixin
,
unittest
.
TestCase
):
...
...
@@ -919,6 +947,23 @@ class TestSlapgridUsageReport(MasterMixin, unittest.TestCase):
[
'getFullComputerInformation'
])
self
.
assertEqual
(
'started'
,
instance
.
state
)
def
test_slapgrid_ignore_free_instance
(
self
):
"""
Test than a free instance (so in "destroyed" state, but empty) is ignored.
"""
computer
=
ComputerForTest
(
self
.
software_root
,
self
.
instance_root
)
instance
=
computer
.
instance_list
[
0
]
computer
.
sequence
=
[]
instance
.
requested_state
=
'destroyed'
self
.
assertTrue
(
self
.
grid
.
processComputerPartitionList
())
# Assert partition directory is empty
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
instance_root
),
[
'0'
,
'etc'
,
'var'
])
self
.
assertSortedListEqual
(
os
.
listdir
(
instance
.
partition_path
),
[])
self
.
assertSortedListEqual
(
os
.
listdir
(
self
.
software_root
),
[
instance
.
software
.
software_hash
])
self
.
assertEqual
(
computer
.
sequence
,
[
'getFullComputerInformation'
])
class
TestSlapgridArgumentTuple
(
unittest
.
TestCase
):
...
...
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