]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Merge "Guarantee there is only one bandwidth limit rule per policy" into feature/qos
authorJenkins <jenkins@review.openstack.org>
Mon, 3 Aug 2015 18:29:29 +0000 (18:29 +0000)
committerGerrit Code Review <review@openstack.org>
Mon, 3 Aug 2015 18:29:29 +0000 (18:29 +0000)
1  2 
neutron/tests/api/test_qos.py

index f476ecf1da7a9bd9e3e32772631f517b99b9c5aa,43ab12b8ca9434a1048e69fff1f4a658de64c6f9..4b617e2f76b3c1fc1a6fb35dea06f2110a2ce2a5
@@@ -252,12 -252,25 +252,27 @@@ class QosBandwidthLimitRuleTestJSON(bas
  
          # Test 'show policy'
          retrieved_policy = self.admin_client.show_qos_policy(policy['id'])
 -        policy_rules = retrieved_policy['policy']['bandwidth_limit_rules']
 +        policy_rules = retrieved_policy['policy']['rules']
          self.assertEqual(1, len(policy_rules))
          self.assertEqual(rule['id'], policy_rules[0]['id'])
 +        self.assertEqual(qos_consts.RULE_TYPE_BANDWIDTH_LIMIT,
 +                         policy_rules[0]['type'])
  
+     @test.attr(type='smoke')
+     @test.idempotent_id('8a59b00b-ab01-4787-92f8-93a5cdf5e378')
+     def test_rule_create_fail_for_the_same_type(self):
+         policy = self.create_qos_policy(name='test-policy',
+                                         description='test policy',
+                                         shared=False)
+         self.create_qos_bandwidth_limit_rule(policy_id=policy['id'],
+                                              max_kbps=200,
+                                              max_burst_kbps=1337)
+         self.assertRaises(exceptions.ServerFault,
+                           self.create_qos_bandwidth_limit_rule,
+                           policy_id=policy['id'],
+                           max_kbps=201, max_burst_kbps=1338)
      @test.attr(type='smoke')
      @test.idempotent_id('149a6988-2568-47d2-931e-2dbc858943b3')
      def test_rule_update(self):