Best Python code snippet using tempest_python
test_network_qos_placement.py
Source:test_network_qos_placement.py
...611 self.assertEqual(612 expected_rp_uuids_in_binding_allocation,613 set(port_binding_alloc.values())614 )615 def assert_no_allocation(self, server, port):616 # check that there are no allocations617 allocations = self.placement_client.list_allocations(618 server['id'])['allocations']619 self.assertEqual(0, len(allocations))620 # check that binding_profile of the port is empty621 port = self.os_admin.ports_client.show_port(port['id'])622 self.assertEqual(0, len(port['port']['binding:profile']))623 @decorators.idempotent_id('93d1a88d-235e-4b7b-b44d-2a17dcf4e213')624 @utils.services('compute', 'network')625 def test_server_create_delete(self):626 min_kbps = 1000627 min_kpps = 100628 policy = self._create_qos_policy_with_bw_and_pps_rules(629 min_kbps, min_kpps)630 port = self._create_port_with_qos_policy(policy)631 server = self.create_server(632 networks=[{'port': port['id']}],633 wait_until='ACTIVE'634 )635 self.assert_allocations(server, port, min_kbps, min_kpps)636 self.servers_client.delete_server(server['id'])637 waiters.wait_for_server_termination(self.servers_client, server['id'])638 self.assert_no_allocation(server, port)639 def _test_create_server_negative(self, min_kbps=1000, min_kpps=100):640 policy = self._create_qos_policy_with_bw_and_pps_rules(641 min_kbps, min_kpps)642 port = self._create_port_with_qos_policy(policy)643 server = self.create_server(644 networks=[{'port': port['id']}],645 wait_until=None)646 waiters.wait_for_server_status(647 client=self.servers_client, server_id=server['id'],648 status='ERROR', ready_wait=False, raise_on_error=False)649 # check that the creation failed with No valid host650 server = self.servers_client.show_server(server['id'])['server']651 self.assertIn('fault', server)652 self.assertIn('No valid host', server['fault']['message'])653 self.assert_no_allocation(server, port)654 @decorators.idempotent_id('915dd2ce-4890-40c8-9db6-f3e04080c6c1')655 @utils.services('compute', 'network')656 def test_server_create_no_valid_host_due_to_bandwidth(self):657 self._test_create_server_negative(min_kbps=self.PLACEMENT_MAX_INT)658 @decorators.idempotent_id('2d4a755e-10b9-4ac0-bef2-3f89de1f150b')659 @utils.services('compute', 'network')660 def test_server_create_no_valid_host_due_to_packet_rate(self):661 self._test_create_server_negative(min_kpps=self.PLACEMENT_MAX_INT)662 @decorators.idempotent_id('69d93e4f-0dfc-4d17-8d84-cc5c3c842cd5')663 @testtools.skipUnless(664 CONF.compute_feature_enabled.resize, 'Resize not available.')665 @utils.services('compute', 'network')666 def test_server_resize(self):667 min_kbps = 1000...
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!!