How to use list_quotas method in tempest

Best Python code snippet using tempest_python

test_list_quotas.py

Source:test_list_quotas.py Github

copy

Full Screen

...4from nidhogg.core import NidhoggException5from nidhogg.sevenmode import SevenMode6from nidhogg.clustermode import ClusterMode7def test_list_quotas_sevenmode_api(sevenmode):8 sevenmode.list_quotas("asdf")9 assert sevenmode.sent == [('quota_report', {'volume': 'asdf'})]10def test_list_quotas_clustermode_api(clustermode):11 clustermode.list_quotas("asdf")12 assert clustermode.sent == [('quota_report_iter', {'max_records': 65536, 'query': {'quota': {'volume': "asdf"}}})]13seven_ret_value = {14 "quotas": {15 "quota": [{16 'disk-limit': "1236",17 'file-limit': "-",18 'threshold': "-",19 'soft-disk-limit': "988",20 'soft-file-limit': "-",21 'quota-target': "/vol/volume/qtree1",22 'files-used': "123",23 'disk-used': "500",24 'tree': "qtree1",25 }, {26 'disk-limit': "1000",27 'file-limit': "1000",28 'threshold': "1000",29 'soft-disk-limit': "1000",30 'soft-file-limit': "1000",31 'quota-target': "/vol/volume/qtree2",32 'files-used': "1000",33 'disk-used': "1000",34 'tree': "qtree2",35 }],36 }37}38cluster_ret_value = {39 'attributes-list': {40 'quota': [{41 'disk-limit': "1236",42 'file-limit': "-",43 'threshold': "-",44 'soft-disk-limit': "988",45 'soft-file-limit': "-",46 'quota-target': "/vol/volume/qtree1",47 'files-used': "123",48 'disk-used': "500",49 'tree': "qtree1",50 }, {51 'disk-limit': "1000",52 'file-limit': "1000",53 'threshold': "1000",54 'soft-disk-limit': "1000",55 'soft-file-limit': "1000",56 'quota-target': "/vol/volume/qtree2",57 'files-used': "1000",58 'disk-used': "1000",59 'tree': "qtree2",60 }],61 },62 'num-records': 2,63}64@pytest.mark.parametrize('mode', [65 (ClusterMode, cluster_ret_value),66 (SevenMode, seven_ret_value)67], indirect=True)68def test_list_quotas(mode):69 assert mode.list_quotas("asdf") == \70 [{'quota_target': u'/vol/volume/qtree1', 'file_limit': -1, 'tree': u'qtree1', 'disk_limit': 1265664.0, 'soft_file_limit': -1, 'threshold': -1, 'disk_used': 512000.0, 'files_used': 123.0, 'soft_disk_limit': 1011712.0},71 {'quota_target': u'/vol/volume/qtree2', 'file_limit': 1000.0, 'tree': u'qtree2', 'disk_limit': 1024000.0, 'soft_file_limit': 1000.0, 'threshold': 1024000.0, 'disk_used': 1024000.0, 'files_used': 1000.0, 'soft_disk_limit': 1024000.0}]72@pytest.mark.parametrize('mode', [73 (ClusterMode, cluster_ret_value),74 (SevenMode, seven_ret_value)75], indirect=True)76def test_allocated_quota_size(mode):77 assert mode.get_allocated_quota_size("vol") == 2289664.078@pytest.mark.parametrize('mode', [79 (ClusterMode, {80 'attributes-list': {81 'quota': {82 'disk-limit': "1236",83 'file-limit': "-",84 'threshold': "-",85 'soft-disk-limit': "988",86 'soft-file-limit': "-",87 'quota-target': "/vol/volume/qtree",88 'files-used': "123",89 'disk-used': "500",90 'tree': "qtree",91 }92 },93 'num-records': 1,94 }),95 (SevenMode, {96 "quotas": {97 "quota": {98 'disk-limit': "1236",99 'file-limit': "-",100 'threshold': "-",101 'soft-disk-limit': "988",102 'soft-file-limit': "-",103 'quota-target': "/vol/volume/qtree",104 'files-used': "123",105 'disk-used': "500",106 'tree': "qtree",107 }108 }109 })110], indirect=True)111def test_list_quotas_single_entry(mode):112 assert mode.list_quotas("asdf") == \113 [{'quota_target': u'/vol/volume/qtree', 'file_limit': -1, 'tree': u'qtree', 'disk_limit': 1265664.0, 'soft_file_limit': -1, 'threshold': -1, 'disk_used': 512000.0, 'files_used': 123.0, 'soft_disk_limit': 1011712.0}]114@pytest.mark.parametrize('mode', [115 (ClusterMode, {'@status': "failed"}),116 (SevenMode, {'@status': "failed"}),117 (SevenMode, {118 'error': {119 'reason': "something went wrong",120 }121 }),122], indirect=True)123def test_list_quotas_failed(mode):124 with pytest.raises(NidhoggException):125 mode.list_quotas("asdf") == []126@pytest.mark.parametrize('mode', [127 (ClusterMode, {128 'status': "passed",129 'num-records': '0'130 }),131 (SevenMode, {})132], indirect=True)133def test_list_qtrees_no_entries(mode):...

Full Screen

Full Screen

check_config_quota_neutron.py

Source:check_config_quota_neutron.py Github

copy

Full Screen

...28 identity_dst = dst_cloud.resources[utl.IDENTITY_RESOURCE]29 network_dst = dst_cloud.resources[utl.NETWORK_RESOURCE]30 search_opts_tenant = kwargs.get('search_opts_tenant', {})31 tenants_src = self.get_src_tenants(search_opts_tenant)32 list_quotas = network_src.list_quotas()33 tenants_without_quotas = self.get_tenants_without_quotas(tenants_src,34 list_quotas)35 if not tenants_without_quotas:36 LOG.info("On SRC cloud all tenants "37 "have custom quotas for network")38 LOG.info("Difference between clouds configs "39 "default quotas will not calculated")40 LOG.info("Migration can proceed")41 return42 LOG.info("Checking default quota "43 "configuration on source and destination cloud")44 quot = network_src.show_quota(tenants_without_quotas[0])45 dst_temp_tenant = identity_dst.create_tenant("Test Tenant For Quotas")46 quot_default_dst = network_dst.show_quota(dst_temp_tenant.id)...

Full Screen

Full Screen

test_quota.py

Source:test_quota.py Github

copy

Full Screen

...23@pytest.mark.sanity24def test_create_quota():25 try:26 sdk_quota.create_quota("jenkins", cpus=4.0, mem=4000)27 quotas = sdk_quota.list_quotas()28 present = False29 for quota in quotas['infos']:30 if quota['role'] == "jenkins":31 present = True32 break33 assert present, "There was no quota present for the jenkins role"34 finally:35 sdk_quota.remove_quota("jenkins")36 quotas = sdk_quota.list_quotas()37 if 'infos' in quotas:38 for quota in quotas['infos']:...

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