Best Python code snippet using tempest_python
test_server_group.py
Source:test_server_group.py
...93 self.assertNotEqual(server_groups[0]['id'], server_groups[1]['id'])94 for i in range(0, 2):95 self._delete_server_group(server_groups[i])96 @decorators.idempotent_id('b3545034-dd78-48f0-bdc2-a4adfa6d0ead')97 def test_show_server_group(self):98 """Test getting the server-group detail"""99 body = self.client.show_server_group(100 self.created_server_group['id'])['server_group']101 self.assertEqual(self.created_server_group, body)102 @decorators.idempotent_id('d4874179-27b4-4d7d-80e4-6c560cdfe321')103 def test_list_server_groups(self):104 """Test listing the server-groups"""105 body = self.client.list_server_groups()['server_groups']106 self.assertIn(self.created_server_group, body)107 @decorators.idempotent_id('ed20d3fb-9d1f-4329-b160-543fbd5d9811')108 @testtools.skipUnless(109 compute.is_scheduler_filter_enabled("ServerGroupAffinityFilter"),110 'ServerGroupAffinityFilter is not available.')111 def test_create_server_with_scheduler_hint_group(self):112 """Test creating a server with the scheduler hint 'group'"""113 hints = {'group': self.created_server_group['id']}114 server = self.create_test_server(scheduler_hints=hints,115 wait_until='ACTIVE')116 self.addCleanup(self.delete_server, server['id'])117 # Check a server is in the group118 server_group = (self.server_groups_client.show_server_group(119 self.created_server_group['id'])['server_group'])120 self.assertIn(server['id'], server_group['members'])121class ServerGroup264TestJSON(base.BaseV2ComputeTest):122 """These tests check for the server-group APIs 2.64 microversion.123 This tests is only to verify the POST, GET server-groups APIs response124 schema with 2.64 microversion125 """126 create_default_network = True127 min_microversion = '2.64'128 @decorators.idempotent_id('b52f09dd-2133-4037-9a5d-bdb260096a88')129 def test_create_get_server_group(self):130 # create, get the test server-group with given policy131 server_group = self.create_test_server_group(132 name='server-group', policy='affinity')133 self.addCleanup(134 self.server_groups_client.delete_server_group,135 server_group['id'])136 self.server_groups_client.list_server_groups()...
test_server_groups.py
Source:test_server_groups.py
...41 self.assertItemsEqual(["anti-affinity"], server_group['policies'])42 self.baremetal_compute_client.delete_server_group(server_group['uuid'])43 @decorators.idempotent_id('e174bcb7-d7fc-467a-8343-a27dd8b2e13c')44 def test_server_group_show(self):45 server_group = self.baremetal_compute_client.show_server_group(46 self.server_group['uuid'])47 self.assertEqual("tempest-test-server_group", server_group['name'])48 self.assertItemsEqual(["anti-affinity"], server_group['policies'])49 @decorators.idempotent_id('b71d790b-92da-4625-8fea-eb79ff4a7a57')50 def test_server_groups_list(self):51 server_groups = self.baremetal_compute_client.list_server_groups()52 self.assertEqual(1, len(server_groups))53 server_group = server_groups[0]54 self.assertEqual("tempest-test-server_group", server_group['name'])55 self.assertItemsEqual(["anti-affinity"], server_group['policies'])56 @decorators.idempotent_id('d14b8011-ce6e-4454-b94d-06b5d5c1ed83')57 def test_server_group_delete(self):58 sg_body = {59 "name": "test-server-group-delete",...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!