Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
d8326a82
Commit
d8326a82
authored
Jan 29, 2013
by
Ilias Tsitsimpis
Browse files
Cleanup after register a new image
parent
c1f67fe1
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-tools/synnefo_tools/burnin.py
View file @
d8326a82
...
...
@@ -235,6 +235,19 @@ class ImagesTestCase(unittest.TestCase):
cls
.
temp_image_name
=
\
SNF_TEST_PREFIX
+
cls
.
imageid
+
".diskdump"
@
classmethod
def
tearDownClass
(
cls
):
"""Remove local files"""
try
:
temp_file
=
os
.
path
.
join
(
cls
.
temp_dir
,
cls
.
temp_image_name
)
os
.
unlink
(
temp_file
)
except
:
pass
try
:
os
.
rmdir
(
cls
.
temp_dir
)
except
:
pass
def
test_001_list_images
(
self
):
"""Test image list actually returns images"""
self
.
assertGreater
(
len
(
self
.
images
),
0
)
...
...
@@ -295,6 +308,24 @@ class ImagesTestCase(unittest.TestCase):
properties
=
{
'OSFAMILY'
:
"linux"
,
'ROOT_PARTITION'
:
1
}
self
.
plankton
.
register
(
self
.
temp_image_name
,
location
,
params
,
properties
)
# Get image id
details
=
self
.
plankton
.
list_public
(
detail
=
True
)
detail
=
filter
(
lambda
x
:
x
[
'owner'
]
==
PITHOS_USER
and
x
[
'name'
]
==
self
.
temp_image_name
,
details
)
self
.
assertEqual
(
len
(
detail
),
1
)
cls
=
type
(
self
)
cls
.
temp_image_id
=
detail
[
0
][
'id'
]
log
.
info
(
"Image registered with id %s"
%
detail
[
0
][
'id'
])
def
test_008_cleanup_image
(
self
):
"""Cleanup image test"""
log
.
info
(
"Cleanup image test"
)
# Remove image from pithos+
pithos_client
=
PithosClient
(
PITHOS
,
TOKEN
,
PITHOS_USER
)
pithos_client
.
container
=
"images"
pithos_client
.
del_object
(
self
.
temp_image_name
)
# --------------------------------------------------------------------
...
...
@@ -2109,7 +2140,7 @@ def main():
'network_spawn': NetworkTestCase}
seq_cases = []
if 'all' in opts.tests:
seq_cases = [UnauthorizedTestCase, ImagesTestCase,
seq_cases = [UnauthorizedTestCase,
C
ImagesTestCase,
FlavorsTestCase, ServersTestCase,
PithosTestCase, ServerTestCase,
NetworkTestCase]
...
...
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