76 |
76 |
# Global Variables
|
77 |
77 |
AUTH_URL = None
|
78 |
78 |
TOKEN = None
|
79 |
|
PLANKTON_USER = None
|
|
79 |
SYSTEM_IMAGES_USER = None
|
80 |
80 |
NO_IPV6 = None
|
81 |
|
DEFAULT_PLANKTON_USER = "images@okeanos.grnet.gr"
|
82 |
81 |
NOFAILFAST = None
|
83 |
82 |
VERBOSE = None
|
84 |
83 |
|
... | ... | |
297 |
296 |
dnames = sorted(map(lambda x: x["name"], self.dimages))
|
298 |
297 |
self.assertEqual(names, dnames)
|
299 |
298 |
|
300 |
|
# XXX: Find a way to resolve owner's uuid to username.
|
301 |
|
# (maybe use astakosclient)
|
302 |
|
# def test_004_unique_image_names(self):
|
303 |
|
# """Test system images have unique names"""
|
304 |
|
# sys_images = filter(lambda x: x['owner'] == PLANKTON_USER,
|
305 |
|
# self.dimages)
|
306 |
|
# names = sorted(map(lambda x: x["name"], sys_images))
|
307 |
|
# self.assertEqual(sorted(list(set(names))), names)
|
|
299 |
def test_004_unique_image_names(self):
|
|
300 |
"""Test system images have unique names"""
|
|
301 |
sys_images = filter(lambda x: x['owner'] == SYSTEM_IMAGES_USER,
|
|
302 |
self.dimages)
|
|
303 |
names = sorted(map(lambda x: x["name"], sys_images))
|
|
304 |
self.assertEqual(sorted(list(set(names))), names)
|
308 |
305 |
|
309 |
306 |
def test_005_image_metadata(self):
|
310 |
307 |
"""Test every image has specific metadata defined"""
|
311 |
308 |
keys = frozenset(["osfamily", "root_partition"])
|
312 |
|
details = self.compute_client.list_images(detail=True)
|
313 |
|
for i in details:
|
|
309 |
sys_images = filter(lambda x: x['owner'] == SYSTEM_IMAGES_USER,
|
|
310 |
self.dimages)
|
|
311 |
for i in sys_images:
|
314 |
312 |
self.assertTrue(keys.issubset(i["metadata"].keys()))
|
315 |
313 |
|
316 |
314 |
def test_006_download_image(self):
|
... | ... | |
1956 |
1954 |
action="store", type="string", dest="auth_url",
|
1957 |
1955 |
help="The AUTH URI to use to reach the Synnefo API",
|
1958 |
1956 |
default=None)
|
1959 |
|
parser.add_option("--plankton-user",
|
1960 |
|
action="store", type="string", dest="plankton_user",
|
|
1957 |
parser.add_option("--system-images-user",
|
|
1958 |
action="store", type="string", dest="system_images_user",
|
1961 |
1959 |
help="Owner of system images",
|
1962 |
|
default=DEFAULT_PLANKTON_USER)
|
|
1960 |
default=None)
|
1963 |
1961 |
parser.add_option("--token",
|
1964 |
1962 |
action="store", type="string", dest="token",
|
1965 |
1963 |
help="The token to use for authentication to the API")
|
... | ... | |
2066 |
2064 |
_mandatory_argument(opts.token, "--token")
|
2067 |
2065 |
# `auth_url' is mandatory
|
2068 |
2066 |
_mandatory_argument(opts.auth_url, "--auth-url")
|
|
2067 |
# `system_images_user' is mandatory
|
|
2068 |
_mandatory_argument(opts.system_images_user, "--system-images-user")
|
2069 |
2069 |
|
2070 |
2070 |
if not opts.show_stale:
|
2071 |
2071 |
# `image-id' is mandatory
|
... | ... | |
2108 |
2108 |
(opts, args) = parse_arguments(sys.argv[1:])
|
2109 |
2109 |
|
2110 |
2110 |
# Some global variables
|
2111 |
|
global AUTH_URL, TOKEN, PLANKTON_USER
|
|
2111 |
global AUTH_URL, TOKEN, SYSTEM_IMAGES_USER
|
2112 |
2112 |
global NO_IPV6, VERBOSE, NOFAILFAST
|
2113 |
2113 |
AUTH_URL = opts.auth_url
|
2114 |
2114 |
TOKEN = opts.token
|
2115 |
|
PLANKTON_USER = opts.plankton_user
|
|
2115 |
SYSTEM_IMAGES_USER = opts.system_images_user
|
2116 |
2116 |
NO_IPV6 = opts.no_ipv6
|
2117 |
2117 |
VERBOSE = opts.verbose
|
2118 |
2118 |
NOFAILFAST = opts.nofailfast
|