Revision e94a9d8c
b/snf-cyclades-app/synnefo/tools/burnin.py | ||
---|---|---|
567 | 567 |
self.assertNotIn(self.serverid, [s["id"] for s in servers]) |
568 | 568 |
|
569 | 569 |
|
570 |
class NetworksTestCase(unittest.TestCase): |
|
571 |
""" Testing networking in cyclades """ |
|
572 |
def setUpClass(cls): |
|
573 |
"Initialize kamaki, get list of current networks" |
|
574 |
conf = Config() |
|
575 |
conf.set('compute_token', TOKEN) |
|
576 |
cls.client = CycladesClient(conf) |
|
577 |
|
|
578 |
#TODO: Create servers, insist until ACTIVE |
|
579 |
#cls.serverid = |
|
580 |
|
|
581 |
def test_001_create_network(): |
|
582 |
"""Test submit create network request""" |
|
583 |
name = SNF_TEST_PREFIX+TEST_RUN_ID |
|
584 |
network = self.client.create_network(name) |
|
585 |
self.assertEqual(network['name'], name) |
|
586 |
|
|
587 |
# Update class attributes to reflect data on new network |
|
588 |
cls = type(self) |
|
589 |
cls.networkid = network['id'] |
|
590 |
|
|
591 |
def test_002_connect_to_network(): |
|
592 |
"""Test VM to network connection""" |
|
593 |
self.client.connect_server(self.serverid, self.networkid) |
|
594 |
|
|
595 |
def test_003_disconnect_from_network(): |
|
596 |
self.client.disconnect_server(self.serverid, self.networkid) |
|
597 |
|
|
598 |
def test_004_destroy_network(): |
|
599 |
"""Test submit delete network request""" |
|
600 |
self.client.delete_network(self.networkid) |
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
|
|
570 | 605 |
class TestRunnerProcess(Process): |
571 | 606 |
"""A distinct process used to execute part of the tests in parallel""" |
572 | 607 |
def __init__(self, **kw): |
... | ... | |
779 | 814 |
opts.force_imageid = str(opts.force_imageid) |
780 | 815 |
except ValueError: |
781 | 816 |
print >>sys.stderr, "Invalid value specified for --image-id." \ |
782 |
"Use a numeric id, or `all'."
|
|
817 |
"Use a valid id, or `all'."
|
|
783 | 818 |
sys.exit(1) |
784 | 819 |
|
785 | 820 |
return (opts, args) |
... | ... | |
816 | 851 |
DFLAVORS = c.list_flavors(detail=True) |
817 | 852 |
|
818 | 853 |
# FIXME: logging, log, LOG PID, TEST_RUN_ID, arguments |
819 |
# FIXME: Network testing? Create, destroy, connect, ping, disconnect VMs? |
|
820 | 854 |
# Run them: FIXME: In parallel, FAILEARLY, catchbreak? |
821 | 855 |
#unittest.main(verbosity=2, catchbreak=True) |
822 | 856 |
|
823 |
test_images = filter(lambda x: x["id"] == opts.force_imageid, DIMAGES) |
|
857 |
if opts.force_imageid == 'all': |
|
858 |
test_images = DIMAGES |
|
859 |
else: |
|
860 |
test_images = filter(lambda x: x["id"] == opts.force_imageid, DIMAGES) |
|
861 |
|
|
824 | 862 |
for image in test_images: |
825 | 863 |
imageid = str(image["id"]) |
826 | 864 |
flavorid = choice([f["id"] for f in DFLAVORS if f["disk"] >= 20]) |
... | ... | |
828 | 866 |
personality = None # FIXME |
829 | 867 |
servername = "%s%s for %s" % (SNF_TEST_PREFIX, TEST_RUN_ID, imagename) |
830 | 868 |
is_windows = imagename.lower().find("windows") >= 0 |
831 |
case = _spawn_server_test_case(imageid=imageid, flavorid=flavorid,
|
|
869 |
ServerTestCase = _spawn_server_test_case(imageid=imageid, flavorid=flavorid,
|
|
832 | 870 |
imagename=imagename, |
833 |
personality=personality, |
|
871 |
perssonality=personality,
|
|
834 | 872 |
servername=servername, |
835 | 873 |
is_windows=is_windows, |
836 | 874 |
action_timeout=opts.action_timeout, |
... | ... | |
839 | 877 |
query_interval=opts.query_interval) |
840 | 878 |
|
841 | 879 |
|
842 |
seq_cases = [UnauthorizedTestCase, FlavorsTestCase, ImagesTestCase, case]
|
|
843 |
|
|
880 |
#Running all the testcases sequentially
|
|
881 |
seq_cases = [UnauthorizedTestCase, FlavorsTestCase, ImagesTestCase, ServerTestCase, NetworkTestCase] |
|
844 | 882 |
for case in seq_cases: |
845 | 883 |
suite = unittest.TestLoader().loadTestsFromTestCase(case) |
846 | 884 |
unittest.TextTestRunner(verbosity=2).run(suite) |
847 |
|
|
885 |
|
|
848 | 886 |
|
849 | 887 |
|
850 | 888 |
# # The Following cases run sequentially |
Also available in: Unified diff