How to use _create_servers_with_group method in tempest

Best Python code snippet using tempest_python

test_servers_on_multinodes.py

Source:test_servers_on_multinodes.py Github

copy

Full Screen

...28 super(ServersOnMultiNodesTest, cls).skip_checks()29 if CONF.compute.min_compute_nodes < 2:30 raise cls.skipException(31 "Less than 2 compute nodes, skipping multi-nodes test.")32 def _create_servers_with_group(self, policy):33 group_id = self.create_test_server_group(policy=[policy])['id']34 hints = {'group': group_id}35 reservation_id = self.create_test_server(36 scheduler_hints=hints, wait_until='ACTIVE', min_count=2,37 return_reservation_id=True)['reservation_id']38 # Get the servers using the reservation_id.39 servers = self.servers_client.list_servers(40 detail=True, reservation_id=reservation_id)['servers']41 self.assertEqual(2, len(servers))42 # Assert the servers are in the group.43 server_group = self.server_groups_client.show_server_group(44 group_id)['server_group']45 hosts = {}46 for server in servers:47 self.assertIn(server['id'], server_group['members'])48 hosts[server['id']] = self.get_host_for_server(server['id'])49 return hosts50 @decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')51 @testtools.skipUnless(52 compute.is_scheduler_filter_enabled("SameHostFilter"),53 'SameHostFilter is not available.')54 def test_create_servers_on_same_host(self):55 hints = {'same_host': self.server01}56 server02 = self.create_test_server(scheduler_hints=hints,57 wait_until='ACTIVE')['id']58 host02 = self.get_host_for_server(server02)59 self.assertEqual(self.host01, host02)60 @decorators.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')61 @testtools.skipUnless(62 compute.is_scheduler_filter_enabled("DifferentHostFilter"),63 'DifferentHostFilter is not available.')64 def test_create_servers_on_different_hosts(self):65 hints = {'different_host': self.server01}66 server02 = self.create_test_server(scheduler_hints=hints,67 wait_until='ACTIVE')['id']68 host02 = self.get_host_for_server(server02)69 self.assertNotEqual(self.host01, host02)70 @decorators.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')71 @testtools.skipUnless(72 compute.is_scheduler_filter_enabled("DifferentHostFilter"),73 'DifferentHostFilter is not available.')74 def test_create_servers_on_different_hosts_with_list_of_servers(self):75 # This scheduler-hint supports list of servers also.76 hints = {'different_host': [self.server01]}77 server02 = self.create_test_server(scheduler_hints=hints,78 wait_until='ACTIVE')['id']79 host02 = self.get_host_for_server(server02)80 self.assertNotEqual(self.host01, host02)81 @decorators.idempotent_id('f8bd0867-e459-45f5-ba53-59134552fe04')82 @testtools.skipUnless(83 compute.is_scheduler_filter_enabled("ServerGroupAntiAffinityFilter"),84 'ServerGroupAntiAffinityFilter is not available.')85 def test_create_server_with_scheduler_hint_group_anti_affinity(self):86 """Tests the ServerGroupAntiAffinityFilter87 Creates two servers in an anti-affinity server group and88 asserts the servers are in the group and on different hosts.89 """90 hosts = self._create_servers_with_group('anti-affinity')91 hostnames = list(hosts.values())92 self.assertNotEqual(hostnames[0], hostnames[1],93 'Servers are on the same host: %s' % hosts)94 @decorators.idempotent_id('9d2e924a-baf4-11e7-b856-fa163e65f5ce')95 @testtools.skipUnless(96 compute.is_scheduler_filter_enabled("ServerGroupAffinityFilter"),97 'ServerGroupAffinityFilter is not available.')98 def test_create_server_with_scheduler_hint_group_affinity(self):99 """Tests the ServerGroupAffinityFilter100 Creates two servers in an affinity server group and101 asserts the servers are in the group and on same host.102 """103 hosts = self._create_servers_with_group('affinity')104 hostnames = list(hosts.values())105 self.assertEqual(hostnames[0], hostnames[1],...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful