QoS unit tests - fix deprecation warning
The QoS unit tests through warnings about illegal UUID This patch fixed it. Change-Id: Ie496125d2385d6282bc67e5b9f69a983b38d0856
This commit is contained in:
parent
f0bea7fead
commit
0daccfebf0
@ -147,22 +147,24 @@ class TestQosNsxV3Notification(nsxlib_testcase.NsxClientTestCase,
|
|||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch.object(nsxlib,
|
with mock.patch.object(nsxlib,
|
||||||
'update_qos_switching_profile_shaping') as update_profile:
|
'update_qos_switching_profile_shaping') as update_profile:
|
||||||
self.qos_plugin.update_policy_bandwidth_limit_rule(
|
with mock.patch('neutron.objects.db.api.update_object',
|
||||||
self.ctxt, self.rule.id, _policy.id, self.rule_data)
|
return_value=self.rule_data):
|
||||||
|
self.qos_plugin.update_policy_bandwidth_limit_rule(
|
||||||
|
self.ctxt, self.rule.id, _policy.id, self.rule_data)
|
||||||
|
|
||||||
# validate the data on the profile
|
# validate the data on the profile
|
||||||
rule_dict = self.rule_data['bandwidth_limit_rule']
|
rule_dict = self.rule_data['bandwidth_limit_rule']
|
||||||
expected_bw = rule_dict['max_kbps'] // 1024
|
expected_bw = rule_dict['max_kbps'] // 1024
|
||||||
expected_burst = rule_dict['max_burst_kbps'] * 128
|
expected_burst = rule_dict['max_burst_kbps'] * 128
|
||||||
update_profile.assert_called_once_with(
|
update_profile.assert_called_once_with(
|
||||||
self.fake_profile_id,
|
self.fake_profile_id,
|
||||||
average_bandwidth=expected_bw,
|
average_bandwidth=expected_bw,
|
||||||
burst_size=expected_burst,
|
burst_size=expected_burst,
|
||||||
peak_bandwidth=expected_bw,
|
peak_bandwidth=expected_bw,
|
||||||
shaping_enabled=True,
|
shaping_enabled=True,
|
||||||
qos_marking='trusted',
|
qos_marking='trusted',
|
||||||
dscp=0
|
dscp=0
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch.object(policy_object.QosPolicy, 'reload_rules')
|
@mock.patch.object(policy_object.QosPolicy, 'reload_rules')
|
||||||
def test_bw_rule_create_profile_minimal_val(self, *mocks):
|
def test_bw_rule_create_profile_minimal_val(self, *mocks):
|
||||||
@ -185,22 +187,24 @@ class TestQosNsxV3Notification(nsxlib_testcase.NsxClientTestCase,
|
|||||||
return_value=_policy):
|
return_value=_policy):
|
||||||
with mock.patch.object(nsxlib,
|
with mock.patch.object(nsxlib,
|
||||||
'update_qos_switching_profile_shaping') as update_profile:
|
'update_qos_switching_profile_shaping') as update_profile:
|
||||||
self.qos_plugin.update_policy_bandwidth_limit_rule(
|
with mock.patch('neutron.objects.db.api.update_object',
|
||||||
self.ctxt, rule.id, _policy.id, rule_data)
|
return_value=rule_data):
|
||||||
|
self.qos_plugin.update_policy_bandwidth_limit_rule(
|
||||||
|
self.ctxt, rule.id, _policy.id, rule_data)
|
||||||
|
|
||||||
# validate the data on the profile
|
# validate the data on the profile
|
||||||
rule_dict = rule_data['bandwidth_limit_rule']
|
rule_dict = rule_data['bandwidth_limit_rule']
|
||||||
expected_bw = qos_utils.MAX_KBPS_MIN_VALUE / 1024
|
expected_bw = qos_utils.MAX_KBPS_MIN_VALUE / 1024
|
||||||
expected_burst = rule_dict['max_burst_kbps'] * 128
|
expected_burst = rule_dict['max_burst_kbps'] * 128
|
||||||
update_profile.assert_called_once_with(
|
update_profile.assert_called_once_with(
|
||||||
self.fake_profile_id,
|
self.fake_profile_id,
|
||||||
average_bandwidth=expected_bw,
|
average_bandwidth=expected_bw,
|
||||||
burst_size=expected_burst,
|
burst_size=expected_burst,
|
||||||
peak_bandwidth=expected_bw,
|
peak_bandwidth=expected_bw,
|
||||||
shaping_enabled=True,
|
shaping_enabled=True,
|
||||||
dscp=0,
|
dscp=0,
|
||||||
qos_marking='trusted'
|
qos_marking='trusted'
|
||||||
)
|
)
|
||||||
|
|
||||||
@mock.patch.object(policy_object.QosPolicy, 'reload_rules')
|
@mock.patch.object(policy_object.QosPolicy, 'reload_rules')
|
||||||
def test_dscp_rule_create_profile(self, *mocks):
|
def test_dscp_rule_create_profile(self, *mocks):
|
||||||
|
@ -101,8 +101,10 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
|
|||||||
self._rules = [self.rule_data['bandwidth_limit_rule']]
|
self._rules = [self.rule_data['bandwidth_limit_rule']]
|
||||||
self._dscp_rules = [self.dscp_rule_data['dscp_marking_rule']]
|
self._dscp_rules = [self.dscp_rule_data['dscp_marking_rule']]
|
||||||
|
|
||||||
mock.patch('neutron.objects.db.api.create_object').start()
|
mock.patch('neutron.objects.db.api.create_object',
|
||||||
mock.patch('neutron.objects.db.api.update_object').start()
|
return_value=self.rule_data).start()
|
||||||
|
mock.patch('neutron.objects.db.api.update_object',
|
||||||
|
return_value=self.rule_data).start()
|
||||||
mock.patch('neutron.objects.db.api.delete_object').start()
|
mock.patch('neutron.objects.db.api.delete_object').start()
|
||||||
mock.patch('neutron.objects.db.api.get_object').start()
|
mock.patch('neutron.objects.db.api.get_object').start()
|
||||||
mock.patch(
|
mock.patch(
|
||||||
|
Loading…
Reference in New Issue
Block a user