Revision 567ffb85 snf-cyclades-app/synnefo/tools/burnin.py
b/snf-cyclades-app/synnefo/tools/burnin.py | ||
---|---|---|
72 | 72 |
|
73 | 73 |
API = None |
74 | 74 |
TOKEN = None |
75 |
DEFAULT_API = "http://127.0.0.1:8000/api/v1.1"
|
|
75 |
DEFAULT_API = "https://cyclades.okeanos.grnet.gr/api/v1.1"
|
|
76 | 76 |
|
77 | 77 |
# A unique id identifying this test run |
78 | 78 |
TEST_RUN_ID = datetime.datetime.strftime(datetime.datetime.now(), |
... | ... | |
88 | 88 |
def test_unauthorized_access(self): |
89 | 89 |
"""Test access without a valid token fails""" |
90 | 90 |
falseToken = '12345' |
91 |
conf = Config() |
|
92 |
conf.set('compute_token', falseToken) |
|
93 |
c=ComputeClient(conf) |
|
91 |
c=ComputeClient(API, falseToken) |
|
94 | 92 |
|
95 | 93 |
with self.assertRaises(ClientError) as cm: |
96 | 94 |
c.list_servers() |
... | ... | |
104 | 102 |
"""Initialize kamaki, get (detailed) list of images""" |
105 | 103 |
log.info("Getting simple and detailed list of images") |
106 | 104 |
|
107 |
conf = Config() |
|
108 |
conf.set('compute_token', TOKEN) |
|
109 |
cls.client = ComputeClient(conf) |
|
105 |
cls.client = ComputeClient(API, TOKEN) |
|
110 | 106 |
cls.images = cls.client.list_images() |
111 | 107 |
cls.dimages = cls.client.list_images(detail=True) |
112 | 108 |
|
... | ... | |
143 | 139 |
"""Initialize kamaki, get (detailed) list of flavors""" |
144 | 140 |
log.info("Getting simple and detailed list of flavors") |
145 | 141 |
|
146 |
conf = Config() |
|
147 |
conf.set('compute_token', TOKEN) |
|
148 |
cls.client = ComputeClient(conf) |
|
142 |
cls.client = ComputeClient(API, TOKEN) |
|
149 | 143 |
cls.flavors = cls.client.list_flavors() |
150 | 144 |
cls.dflavors = cls.client.list_flavors(detail=True) |
151 | 145 |
|
... | ... | |
187 | 181 |
"""Initialize kamaki, get (detailed) list of servers""" |
188 | 182 |
log.info("Getting simple and detailed list of servers") |
189 | 183 |
|
190 |
conf = Config() |
|
191 |
conf.set('compute_token', TOKEN) |
|
192 |
cls.client = ComputeClient(conf) |
|
184 |
cls.client = ComputeClient(API, TOKEN) |
|
193 | 185 |
cls.servers = cls.client.list_servers() |
194 | 186 |
cls.dservers = cls.client.list_servers(detail=True) |
195 | 187 |
|
... | ... | |
217 | 209 |
"""Initialize a kamaki instance""" |
218 | 210 |
log.info("Spawning server for image `%s'", cls.imagename) |
219 | 211 |
|
220 |
conf = Config() |
|
221 |
conf.set('compute_token', TOKEN) |
|
222 |
cls.client = ComputeClient(conf) |
|
223 |
cls.cyclades = CycladesClient(conf) |
|
212 |
cls.client = ComputeClient(API, TOKEN) |
|
213 |
cls.cyclades = CycladesClient(API, TOKEN) |
|
224 | 214 |
|
225 | 215 |
def _get_ipv4(self, server): |
226 | 216 |
"""Get the public IPv4 of a server from the detailed server info""" |
... | ... | |
611 | 601 |
@classmethod |
612 | 602 |
def setUpClass(cls): |
613 | 603 |
"Initialize kamaki, get list of current networks" |
614 |
conf = Config() |
|
615 |
conf.set('compute_token', TOKEN) |
|
616 |
cls.client = CycladesClient(conf) |
|
617 |
cls.compute = ComputeClient(conf) |
|
604 |
|
|
605 |
cls.client = CycladesClient(API, TOKEN) |
|
606 |
cls.compute = ComputeClient(API, TOKEN) |
|
618 | 607 |
|
619 | 608 |
images = cls.compute.list_images(detail = True) |
620 | 609 |
flavors = cls.compute.list_flavors(detail = True) |
... | ... | |
639 | 628 |
build_fail=500, |
640 | 629 |
query_interval=3) |
641 | 630 |
|
642 |
#Using already implemented tests for serverlist population |
|
631 |
#Using already implemented tests for server list population
|
|
643 | 632 |
suite = unittest.TestSuite() |
644 | 633 |
suite.addTest(setupCase('test_001_submit_create_server')) |
645 | 634 |
suite.addTest(setupCase('test_002a_server_is_building_in_list')) |
646 | 635 |
suite.addTest(setupCase('test_002b_server_is_building_in_details')) |
647 | 636 |
suite.addTest(setupCase('test_003_server_becomes_active')) |
648 | 637 |
unittest.TextTestRunner(verbosity=2).run(suite) |
638 |
unittest.TextTestRunner(verbosity=2).run(suite) |
|
639 |
|
|
649 | 640 |
|
650 | 641 |
def test_001_create_network(self): |
651 | 642 |
"""Test submit create network request""" |
... | ... | |
849 | 840 |
|
850 | 841 |
def cleanup_servers(delete_stale=False): |
851 | 842 |
|
852 |
conf = Config() |
|
853 |
conf.set('compute_token', TOKEN) |
|
854 |
c = ComputeClient(conf) |
|
843 |
c = ComputeClient(API, TOKEN) |
|
855 | 844 |
|
856 | 845 |
servers = c.list_servers() |
857 | 846 |
stale = [s for s in servers if s["name"].startswith(SNF_TEST_PREFIX)] |
... | ... | |
1004 | 993 |
|
1005 | 994 |
# Initialize a kamaki instance, get flavors, images |
1006 | 995 |
|
1007 |
conf = Config() |
|
1008 |
conf.set('compute_token', TOKEN) |
|
1009 |
c = ComputeClient(conf) |
|
996 |
c = ComputeClient(API, TOKEn) |
|
1010 | 997 |
|
1011 | 998 |
DIMAGES = c.list_images(detail=True) |
1012 | 999 |
DFLAVORS = c.list_flavors(detail=True) |
... | ... | |
1025 | 1012 |
flavorid = choice([f["id"] for f in DFLAVORS if f["disk"] >= 20]) |
1026 | 1013 |
imagename = image["name"] |
1027 | 1014 |
|
1028 |
|
|
1015 |
#Personality dictionary for file injection test |
|
1029 | 1016 |
if opts.personality_path != None: |
1030 | 1017 |
f = open(opts.personality_path) |
1031 | 1018 |
content = b64encode(f.read()) |
... | ... | |
1057 | 1044 |
|
1058 | 1045 |
|
1059 | 1046 |
#Running all the testcases sequentially |
1060 |
#seq_cases = [UnauthorizedTestCase, FlavorsTestCase, ImagesTestCase, ServerTestCase, NetworkTestCase] |
|
1061 | 1047 |
|
1062 |
newNetworkTestCase = _spawn_network_test_case(action_timeout = opts.action_timeout,
|
|
1063 |
query_interval = opts.query_interval)
|
|
1048 |
#To run all cases
|
|
1049 |
#seq_cases = [UnauthorizedTestCase, FlavorsTestCase, ImagesTestCase, ServerTestCase, NetworkTestCase]
|
|
1064 | 1050 |
|
1051 |
newNetworkTestCase = _spawn_network_test_case(action_timeout = opts.action_timeout,query_interval = opts.query_interval) |
|
1065 | 1052 |
seq_cases = [newNetworkTestCase] |
1053 |
|
|
1066 | 1054 |
for case in seq_cases: |
1067 | 1055 |
suite = unittest.TestLoader().loadTestsFromTestCase(case) |
1068 | 1056 |
unittest.TextTestRunner(verbosity=2).run(suite) |
Also available in: Unified diff