How to use _delete_pool method in lisa

Best Python code snippet using lisa_python

test_pools_non_admin.py

Source:test_pools_non_admin.py Github

copy

Full Screen

...70 new_pool = self.pools_client.get_pool(new_pool['id'])71 pools = self.pools_client.list_pools()72 self.assertEqual(1, len(pools))73 self.assertIn(new_pool, pools)74 self._delete_pool(new_pool.get('id'))75 @test.attr(type='smoke')76 def test_list_pools_two(self):77 """Test get pools with two pools"""78 new_pool1 = self._prepare_and_create_pool()79 new_pool2 = self._prepare_and_create_pool()80 pools = self.pools_client.list_pools()81 self.assertEqual(2, len(pools))82 self.assertIn(new_pool1, pools)83 self.assertIn(new_pool2, pools)84 self._delete_pool(new_pool1.get('id'))85 self._delete_pool(new_pool2.get('id'))86 @test.attr(type='smoke')87 def test_get_pool(self):88 """Test get pool"""89 new_pool = self._prepare_and_create_pool()90 pool = self.pools_client.get_pool(new_pool.get('id'))91 self.assertEqual(new_pool, pool)92 self._delete_pool(new_pool.get('id'))93 @test.attr(type='smoke')94 def test_create_pool(self):95 """Test create pool"""96 new_pool = self._prepare_and_create_pool()97 pool = self.pools_client.get_pool(new_pool.get('id'))98 self.assertEqual(new_pool, pool)99 self._delete_pool(new_pool.get('id'))100 @test.attr(type='negative')101 def test_create_pool_missing_required_fields(self):102 """Test create pool with a missing required fields"""103 tenant_id = self.subnet.get('tenant_id')104 self.assertRaises(ex.BadRequest, self._create_pool,105 tenant_id=tenant_id,106 lb_algorithm='ROUND_ROBIN')107 @test.attr(type='smoke')108 def test_create_pool_missing_tenant_field(self):109 """Test create pool with a missing required tenant field"""110 tenant_id = self.subnet.get('tenant_id')111 new_pool = self._prepare_and_create_pool(112 protocol='HTTP',113 lb_algorithm='ROUND_ROBIN')114 pool = self.pools_client.get_pool(new_pool.get('id'))115 pool_tenant = pool['tenant_id']116 self.assertEqual(tenant_id, pool_tenant)117 self._delete_pool(new_pool.get('id'))118 @test.attr(type='negative')119 def test_create_pool_missing_protocol_field(self):120 """Test create pool with a missing required protocol field"""121 self.increment_protocol_port()122 listener = self.listeners_client.create_listener(123 loadbalancer_id=self.load_balancer.get('id'),124 protocol='HTTP', protocol_port=PROTOCOL_PORT)125 listener_id = listener.get('id')126 tenant_id = self.subnet.get('tenant_id')127 self.assertRaises(ex.BadRequest, self._create_pool,128 tenant_id=tenant_id,129 listener_id=listener_id,130 lb_algorithm='ROUND_ROBIN')131 @test.attr(type='negative')132 def test_create_pool_missing_lb_algorithm_field(self):133 """Test create pool with a missing required lb algorithm field"""134 self.increment_protocol_port()135 listener = self.listeners_client.create_listener(136 loadbalancer_id=self.load_balancer.get('id'),137 protocol='HTTP', protocol_port=PROTOCOL_PORT)138 listener_id = listener.get('id')139 tenant_id = self.subnet.get('tenant_id')140 self.assertRaises(ex.BadRequest, self._create_pool,141 tenant_id=tenant_id,142 listener_id=listener_id,143 protocol='HTTP')144 @test.attr(type='negative')145 def test_create_pool_missing_listener_id_field(self):146 """Test create pool with a missing required listener id field"""147 tenant_id = self.subnet.get('tenant_id')148 self.assertRaises(ex.BadRequest, self._create_pool,149 tenant_id=tenant_id,150 lb_algorithm='ROUND_ROBIN',151 protocol='HTTP')152 @test.attr(type='smoke')153 def test_create_pool_missing_description_field(self):154 """Test create pool with missing description field"""155 self._wait_for_load_balancer_status(self.load_balancer.get('id'))156 new_pool = self._prepare_and_create_pool()157 pool_initial = self.pools_client.get_pool(new_pool.get('id'))158 desc = pool_initial.get('description')159 self.assertEqual(desc, "")160 self._delete_pool(new_pool.get('id'))161 @test.attr(type='smoke')162 def test_create_pool_missing_name_field(self):163 """Test create pool with a missing name field"""164 self._wait_for_load_balancer_status(self.load_balancer.get('id'))165 new_pool = self._prepare_and_create_pool()166 pool_initial = self.pools_client.get_pool(new_pool.get('id'))167 name = pool_initial.get('name')168 self.assertEqual(name, "")169 self._delete_pool(new_pool.get('id'))170 @test.attr(type='smoke')171 def test_create_pool_missing_admin_state_up_field(self):172 """Test create pool with a missing admin_state_up field"""173 self._wait_for_load_balancer_status(self.load_balancer.get('id'))174 new_pool = self._prepare_and_create_pool()175 pool_initial = self.pools_client.get_pool(new_pool.get('id'))176 state = pool_initial.get('admin_state_up')177 self.assertEqual(state, True)178 self._delete_pool(new_pool.get('id'))179 @test.attr(type='smoke')180 def test_create_pool_missing_session_pers_field(self):181 """Test create pool with a missing session_pers field"""182 self._wait_for_load_balancer_status(self.load_balancer.get('id'))183 new_pool = self._prepare_and_create_pool()184 pool_initial = self.pools_client.get_pool(new_pool.get('id'))185 sess = pool_initial.get('session_persistence')186 self.assertIsNone(sess)187 self._delete_pool(new_pool.get('id'))188 @test.attr(type='negative')189 def test_create_pool_invalid_protocol(self):190 """Test create pool with an invalid protocol"""191 self.assertRaises(ex.BadRequest, self._create_pool,192 protocol='UDP',193 lb_algorithm='ROUND_ROBIN')194 @test.attr(type='negative')195 def test_create_pool_invalid_session_persistence_field(self):196 """Test create pool with invalid session persistance field"""197 self.assertRaises(ex.BadRequest, self._create_pool,198 protocol='HTTP',199 session_persistence={'type': 'HTTP'},200 lb_algorithm='ROUND_ROBIN')201 @test.attr(type='negative')202 def test_create_pool_invalid_algorithm(self):203 """Test create pool with an invalid algorithm"""204 self.assertRaises(ex.BadRequest, self._create_pool,205 protocol='HTTP',206 lb_algorithm='LEAST_CON')207 @test.attr(type='negative')208 def test_create_pool_invalid_admin_state_up(self):209 """Test create pool with an invalid admin state up field"""210 self.assertRaises(ex.BadRequest, self._create_pool,211 protocol='HTTP',212 admin_state_up="$!1%9823",213 lb_algorithm='ROUND_ROBIN')214 @test.attr(type='negative')215 def test_create_pool_invalid_listener_field(self):216 """Test create pool with invalid listener field"""217 tenant_id = self.subnet.get('tenant_id')218 self.assertRaises(ex.BadRequest, self._create_pool,219 tenant_id=tenant_id,220 lb_algorithm='ROUND_ROBIN',221 protocol='HTTP',222 listener_id="$@5$%$7863")223 @test.attr(type='negative')224 def test_create_pool_invalid_tenant_id_field(self):225 """Test create pool with invalid tenant_id field"""226 self.increment_protocol_port()227 listener = self.listeners_client.create_listener(228 loadbalancer_id=self.load_balancer.get('id'),229 protocol='HTTP', protocol_port=PROTOCOL_PORT)230 listener_id = listener.get('id')231 self.assertRaises(ex.BadRequest, self._create_pool,232 tenant_id="*&7653^%&",233 lb_algorithm='ROUND_ROBIN',234 protocol='HTTP',235 listener_id=listener_id)236 @test.attr(type='negative')237 def test_create_pool_incorrect_attribute(self):238 """Test create a pool with an extra, incorrect field"""239 self.assertRaises(ex.BadRequest, self._create_pool,240 protocol='HTTP',241 lb_algorithm='ROUND_ROBIN',242 protocol_port=80)243 @test.attr(type='negative')244 def test_create_pool_empty_listener_field(self):245 """Test create pool with empty listener field"""246 tenant_id = self.subnet.get('tenant_id')247 self.assertRaises(ex.BadRequest, self._create_pool,248 tenant_id=tenant_id,249 lb_algorithm='ROUND_ROBIN',250 protocol='HTTP',251 listener_id="")252 @test.attr(type='smoke')253 def test_create_pool_empty_description_field(self):254 """Test create pool with empty description field"""255 new_pool = self._prepare_and_create_pool(256 description="")257 pool = self.pools_client.get_pool(new_pool.get('id'))258 pool_desc = pool.get('description')259 self.assertEqual(pool_desc, '')260 self._delete_pool(new_pool.get('id'))261 @test.attr(type='smoke')262 def test_create_pool_empty_name_field(self):263 """Test create pool with empty name field"""264 new_pool = self._prepare_and_create_pool(265 name="")266 pool = self.pools_client.get_pool(new_pool.get('id'))267 pool_name = pool.get('name')268 self.assertEqual(pool_name, '')269 self._delete_pool(new_pool.get('id'))270 @test.attr(type='negative')271 def test_create_pool_empty_protocol(self):272 """Test create pool with an empty protocol"""273 self.assertRaises(ex.BadRequest, self._create_pool,274 protocol="",275 lb_algorithm='ROUND_ROBIN')276 @test.attr(type='negative')277 def test_create_pool_empty_session_persistence_field(self):278 """Test create pool with empty session persistence field"""279 self.assertRaises(ex.BadRequest, self._create_pool,280 session_persistence="",281 protocol='HTTP',282 lb_algorithm='ROUND_ROBIN')283 @test.attr(type='negative')284 def test_create_pool_empty_algorithm(self):285 """Test create pool with an empty algorithm"""286 self.assertRaises(ex.BadRequest, self._create_pool,287 protocol='HTTP',288 lb_algorithm="")289 @test.attr(type='negative')290 def test_create_pool_empty_admin_state_up(self):291 """Test create pool with an invalid admin state up field"""292 self.assertRaises(ex.BadRequest, self._create_pool,293 protocol='HTTP',294 admin_state_up="",295 lb_algorithm='ROUND_ROBIN')296 @test.attr(type='negative')297 def test_create_pool_empty_tenant_field(self):298 """Test create pool with empty tenant field"""299 self.assertRaises(ex.BadRequest, self._create_pool,300 protocol='HTTP',301 tenant_id="",302 lb_algorithm='ROUND_ROBIN')303 @test.attr(type='negative')304 def test_create_pool_for_other_tenant_field(self):305 """Test create pool for other tenant field"""306 tenant = 'deffb4d7c0584e89a8ec99551565713c'307 self.assertRaises(ex.BadRequest, self._create_pool,308 protocol='HTTP',309 tenant_id=tenant,310 lb_algorithm='ROUND_ROBIN')311 @test.skip_because(bug="1434717")312 @test.attr(type='negative')313 def test_create_pool_invalid_name_field(self):314 """315 known bug with input more than 255 chars316 Test create pool with invalid name field317 """318 self.assertRaises(ex.BadRequest, self._create_pool,319 protocol='HTTP',320 lb_algorithm='ROUND_ROBIN',321 name='n' * 256)322 @test.skip_because(bug="1434717")323 @test.attr(type='negative')324 def test_create_pool_invalid_desc_field(self):325 """326 known bug with input more than 255 chars327 Test create pool with invalid desc field328 """329 self.assertRaises(ex.BadRequest, self._create_pool,330 protocol='HTTP',331 lb_algorithm='ROUND_ROBIN',332 description='d' * 256)333 @test.attr(type='negative')334 def test_create_pool_with_session_persistence_unsupported_type(self):335 """Test create a pool with an incorrect type value336 for session persistence337 """338 self.assertRaises(ex.BadRequest, self._create_pool,339 session_persistence={'type': 'UNSUPPORTED'},340 protocol='HTTP',341 lb_algorithm='ROUND_ROBIN')342 @test.attr(type='smoke')343 def test_create_pool_with_session_persistence_http_cookie(self):344 """Test create a pool with session_persistence type=HTTP_COOKIE"""345 new_pool = self._prepare_and_create_pool(346 session_persistence={'type': 'HTTP_COOKIE'})347 pool = self.pools_client.get_pool(new_pool.get('id'))348 self.assertEqual(new_pool, pool)349 self._delete_pool(new_pool.get('id'))350 @test.attr(type='smoke')351 def test_create_pool_with_session_persistence_app_cookie(self):352 """Test create a pool with session_persistence type=APP_COOKIE"""353 new_pool = self._prepare_and_create_pool(354 session_persistence={'type': 'APP_COOKIE',355 'cookie_name': 'sessionId'})356 pool = self.pools_client.get_pool(new_pool.get('id'))357 self.assertEqual(new_pool, pool)358 self._delete_pool(new_pool.get('id'))359 @test.attr(type='negative')360 def test_create_pool_with_session_persistence_redundant_cookie_name(self):361 """Test create a pool with session_persistence with cookie_name362 for type=HTTP_COOKIE363 """364 self.assertRaises(ex.BadRequest, self._create_pool,365 session_persistence={'type': 'HTTP_COOKIE',366 'cookie_name': 'sessionId'},367 protocol='HTTP',368 lb_algorithm='ROUND_ROBIN')369 @test.attr(type='negative')370 def test_create_pool_with_session_persistence_without_cookie_name(self):371 """Test create a pool with session_persistence without372 cookie_name for type=APP_COOKIE373 """374 self.assertRaises(ex.BadRequest, self._create_pool,375 session_persistence={'type': 'APP_COOKIE'},376 protocol='HTTP',377 lb_algorithm='ROUND_ROBIN')378 @test.attr(type='smoke')379 def test_update_pool(self):380 """Test update pool"""381 new_pool = self._prepare_and_create_pool()382 desc = 'testing update with new description'383 pool = self._update_pool(new_pool.get('id'),384 description=desc)385 self.assertEqual(desc, pool.get('description'))386 self._delete_pool(new_pool.get('id'))387 @test.attr(type='smoke')388 def test_update_pool_missing_name(self):389 """Test update pool with missing name"""390 new_pool = self._prepare_and_create_pool()391 pool_initial = self.pools_client.get_pool(new_pool.get('id'))392 name = pool_initial.get('name')393 pool = self.pools_client.update_pool(new_pool.get('id'))394 self._wait_for_load_balancer_status(self.load_balancer.get('id'))395 self.assertEqual(name, pool.get('name'))396 self._delete_pool(new_pool.get('id'))397 @test.attr(type='smoke')398 def test_update_pool_missing_description(self):399 """Test update pool with missing description"""400 new_pool = self._prepare_and_create_pool()401 pool_initial = self.pools_client.get_pool(new_pool.get('id'))402 desc = pool_initial.get('description')403 pool = self.pools_client.update_pool(new_pool.get('id'))404 self._wait_for_load_balancer_status(self.load_balancer.get('id'))405 self.assertEqual(desc, pool.get('description'))406 self._delete_pool(new_pool.get('id'))407 @test.attr(type='smoke')408 def test_update_pool_missing_admin_state_up(self):409 """Test update pool with missing admin state up field"""410 new_pool = self._prepare_and_create_pool()411 pool_initial = self.pools_client.get_pool(new_pool.get('id'))412 admin = pool_initial.get('admin_state_up')413 pool = self.pools_client.update_pool(new_pool.get('id'))414 self._wait_for_load_balancer_status(self.load_balancer.get('id'))415 self.assertEqual(admin, pool.get('admin_state_up'))416 self._delete_pool(new_pool.get('id'))417 @test.attr(type='smoke')418 def test_update_pool_missing_session_persistence(self):419 """Test update pool with missing session persistence"""420 new_pool = self._prepare_and_create_pool()421 pool_initial = self.pools_client.get_pool(new_pool.get('id'))422 sess_pers = pool_initial.get('session_persistence')423 pool = self.pools_client.update_pool(new_pool.get('id'))424 self._wait_for_load_balancer_status(self.load_balancer.get('id'))425 self.assertAlmostEqual(sess_pers, pool.get('session_persistence'))426 self._delete_pool(new_pool.get('id'))427 @test.skip_because(bug="1434717")428 @test.attr(type='negative')429 def test_update_pool_invalid_name(self):430 """Test update pool with invalid name"""431 new_pool = self._prepare_and_create_pool()432 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,433 new_pool.get('id'), name='n' * 256)434 self._delete_pool(new_pool.get('id'))435 @test.skip_because(bug="1434717")436 @test.attr(type='negative')437 def test_update_pool_invalid_desc(self):438 """Test update pool with invalid desc"""439 new_pool = self._prepare_and_create_pool()440 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,441 new_pool.get('id'),442 description='d' * 256)443 self._delete_pool(new_pool.get('id'))444 @test.attr(type='negative')445 def test_update_pool_invalid_admin_state_up(self):446 """Test update pool with an invalid admin_state_up"""447 new_pool = self._prepare_and_create_pool()448 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,449 new_pool.get('id'), admin_state_up='hello')450 self._delete_pool(new_pool.get('id'))451 @test.attr(type='negative')452 def test_update_pool_invalid_session_persistence(self):453 """Test update pool with an invalid session pers. field"""454 new_pool = self._prepare_and_create_pool()455 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,456 new_pool.get('id'),457 session_persistence={'type': 'Hello'})458 self._delete_pool(new_pool.get('id'))459 @test.attr(type='smoke')460 def test_update_pool_empty_name(self):461 """Test update pool with empty name"""462 new_pool = self._prepare_and_create_pool()463 pool = self.pools_client.update_pool(new_pool.get('id'),464 name="")465 self._wait_for_load_balancer_status(self.load_balancer.get('id'))466 self.assertEqual(pool.get('name'), "")467 self._delete_pool(new_pool.get('id'))468 @test.attr(type='smoke')469 def test_update_pool_empty_description(self):470 """Test update pool with empty description"""471 new_pool = self._prepare_and_create_pool()472 pool = self.pools_client.update_pool(new_pool.get('id'),473 description="")474 self._wait_for_load_balancer_status(self.load_balancer.get('id'))475 self.assertEqual(pool.get('description'), "")476 self._delete_pool(new_pool.get('id'))477 @test.attr(type='negative')478 def test_update_pool_empty_admin_state_up(self):479 """Test update pool with empty admin state up"""480 new_pool = self._prepare_and_create_pool()481 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,482 new_pool.get('id'), admin_state_up="")483 self._delete_pool(new_pool.get('id'))484 @test.attr(type='negative')485 def test_update_pool_empty_session_persistence(self):486 """Test update pool with empty session persistence field"""487 new_pool = self._prepare_and_create_pool()488 self.assertRaises(ex.BadRequest, self.pools_client.update_pool,489 new_pool.get('id'),490 session_persistence="")491 self.pools_client.delete_pool(new_pool.get('id'))492 @test.attr(type='negative')493 def test_update_pool_invalid_attribute(self):494 """Test update pool with an invalid attribute"""495 new_pool = self._prepare_and_create_pool()496 self.assertRaises(ex.BadRequest, self._update_pool,497 new_pool.get('id'), lb_algorithm='ROUNDED')498 self._delete_pool(new_pool.get('id'))499 @test.attr(type='negative')500 def test_update_pool_incorrect_attribute(self):501 """Test update a pool with an extra, incorrect field"""502 new_pool = self._prepare_and_create_pool()503 self.assertRaises(ex.BadRequest, self._update_pool,504 new_pool.get('id'), protocol='HTTPS')505 self._delete_pool(new_pool.get('id'))506 @test.attr(type='smoke')507 def test_delete_pool(self):508 """Test delete pool"""509 new_pool = self._prepare_and_create_pool()510 pool = self.pools_client.get_pool(new_pool.get('id'))511 self.assertEqual(new_pool, pool)512 self._delete_pool(new_pool.get('id'))513 self.assertRaises(ex.NotFound, self.pools_client.get_pool,514 new_pool.get('id'))515 @test.attr(type='smoke')516 def test_delete_invalid_pool(self):517 """Test delete pool that doesn't exist"""518 new_pool = self._prepare_and_create_pool()519 pool = self.pools_client.get_pool(new_pool.get('id'))520 self.assertEqual(new_pool, pool)521 self._delete_pool(new_pool.get('id'))522 self.assertRaises(ex.NotFound, self._delete_pool,...

Full Screen

Full Screen

mdadm.py

Source:mdadm.py Github

copy

Full Screen

...128 ) -> None:129 # delete virtual disk if it exists130 self.node.tools[HyperV].delete_virtual_disk(volume_name)131 # delete storage pool132 self._delete_pool(pool_name)133 def _exists_pool(self, pool_name: str) -> bool:134 output = self.node.tools[PowerShell].run_cmdlet(135 f"Get-StoragePool -FriendlyName {pool_name}",136 fail_on_error=False,137 force_run=True,138 )139 return output.strip() != ""140 def _delete_pool(self, pool_name: str) -> None:141 if self._exists_pool(pool_name):142 self.node.tools[PowerShell].run_cmdlet(143 f"Remove-StoragePool -FriendlyName {pool_name} -confirm:$false",144 force_run=True,145 )146 def _create_pool(self, pool_name: str) -> None:147 # delete pool if exists148 self._delete_pool(pool_name)149 # create pool150 self.node.tools[PowerShell].run_cmdlet(151 "$disks = Get-PhysicalDisk -CanPool $true; New-StoragePool "152 "-StorageSubSystemFriendlyName 'Windows Storage*' "153 f"-FriendlyName {pool_name} -PhysicalDisks $disks",154 force_run=True,...

Full Screen

Full Screen

test_pools_admin.py

Source:test_pools_admin.py Github

copy

Full Screen

...64 tenant_id="")65 pool = self.pools_client.get_pool(new_pool.get('id'))66 pool_tenant = pool.get('tenant_id')67 self.assertEqual(pool_tenant, '')68 self._delete_pool(new_pool.get('id'))69 @test.attr(type='smoke')70 def test_create_pool_missing_tenant_id_for_other_tenant(self):71 """72 Test create pool with a missing tenant id field. Verify73 tenant_id does not match when creating pool vs.74 pool (admin client)75 """76 new_pool = self._prepare_and_create_pool(77 protocol='HTTP',78 lb_algorithm='ROUND_ROBIN')79 pool = self.pools_client.get_pool(new_pool.get('id'))80 pool_tenant = pool['tenant_id']81 self.assertNotEqual(pool_tenant, self.subnet['tenant_id'])82 self._delete_pool(new_pool.get('id'))83 @test.attr(type='smoke')84 def test_create_pool_missing_tenant_id_for_admin(self):85 """86 Test create pool with a missing tenant id field. Verify87 tenant_id matches when creating pool vs. pool (admin client)88 """89 new_pool = self._prepare_and_create_pool(90 protocol='HTTP',91 lb_algorithm='ROUND_ROBIN')92 pool = self.pools_client.get_pool(new_pool.get('id'))93 pool_tenant = pool['tenant_id']94 self.assertEqual(pool_tenant, pool.get('tenant_id'))95 self._delete_pool(new_pool.get('id'))96 @test.attr(type='smoke')97 def test_create_pool_for_another_tenant(self):98 """Test create pool for other tenant field"""99 tenant = 'deffb4d7c0584e89a8ec99551565713c'100 new_pool = self._prepare_and_create_pool(101 tenant_id=tenant)102 pool = self.pools_client.get_pool(new_pool.get('id'))103 pool_tenant = pool.get('tenant_id')104 self.assertEqual(pool_tenant, tenant)...

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 lisa 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