Merge "request obj prepare for supporting health check"
This commit is contained in:
commit
964fd19497
|
@ -156,7 +156,8 @@ class ClusterResizeRequest(base.SenlinObject):
|
|||
'min_size': fields.CapacityField(nullable=True, minimum=0),
|
||||
'max_size': fields.CapacityField(nullable=True, minimum=-1),
|
||||
'min_step': fields.NonNegativeIntegerField(nullable=True),
|
||||
'strict': fields.BooleanField(nullable=True, default=True)
|
||||
'strict': fields.BooleanField(nullable=True, default=True),
|
||||
'health_check': fields.BooleanField(nullable=True, default=False)
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,7 +166,8 @@ class ClusterScaleInRequest(base.SenlinObject):
|
|||
|
||||
fields = {
|
||||
'identity': fields.StringField(),
|
||||
'count': fields.NonNegativeIntegerField(nullable=True)
|
||||
'count': fields.NonNegativeIntegerField(nullable=True),
|
||||
'health_check': fields.BooleanField(nullable=True, default=False)
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,7 +176,8 @@ class ClusterScaleOutRequest(base.SenlinObject):
|
|||
|
||||
fields = {
|
||||
'identity': fields.StringField(),
|
||||
'count': fields.NonNegativeIntegerField(nullable=True)
|
||||
'count': fields.NonNegativeIntegerField(nullable=True),
|
||||
'health_check': fields.BooleanField(nullable=True, default=False)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -332,6 +332,7 @@ class TestClusterResize(test_base.SenlinTestCase):
|
|||
self.assertFalse(sot.obj_attr_is_set('max_size'))
|
||||
self.assertFalse(sot.obj_attr_is_set('min_step'))
|
||||
self.assertFalse(sot.obj_attr_is_set('strict'))
|
||||
self.assertFalse(sot.obj_attr_is_set('health_check'))
|
||||
|
||||
def test_init_with_params(self):
|
||||
sot = clusters.ClusterResizeRequest(identity='foo',
|
||||
|
@ -350,6 +351,9 @@ class TestClusterResize(test_base.SenlinTestCase):
|
|||
self.assertEqual(1, sot.min_step)
|
||||
self.assertFalse(sot.strict)
|
||||
|
||||
sot.obj_set_defaults()
|
||||
self.assertFalse(sot.health_check)
|
||||
|
||||
def test_init_failed_type(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterResizeRequest,
|
||||
|
@ -393,6 +397,15 @@ class TestClusterResize(test_base.SenlinTestCase):
|
|||
identity='foo', strict='fake')
|
||||
self.assertIn("Unrecognized value 'fake'", six.text_type(ex))
|
||||
|
||||
def test_init_invalid_boolean(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterResizeRequest,
|
||||
identity='foo', health_check="foo")
|
||||
self.assertEqual(
|
||||
"Unrecognized value 'foo', acceptable values are: '0', '1', "
|
||||
"'f', 'false', 'n', 'no', 'off', 'on', 't', 'true', 'y', 'yes'",
|
||||
six.text_type(ex))
|
||||
|
||||
|
||||
class TestClusterScaleIn(test_base.SenlinTestCase):
|
||||
|
||||
|
@ -402,6 +415,9 @@ class TestClusterScaleIn(test_base.SenlinTestCase):
|
|||
self.assertEqual('foo', sot.identity)
|
||||
self.assertEqual(5, sot.count)
|
||||
|
||||
sot.obj_set_defaults()
|
||||
self.assertFalse(sot.health_check)
|
||||
|
||||
def test_init_failed(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterScaleInRequest,
|
||||
|
@ -409,6 +425,15 @@ class TestClusterScaleIn(test_base.SenlinTestCase):
|
|||
self.assertEqual("Value must be >= 0 for field 'count'.",
|
||||
six.text_type(ex))
|
||||
|
||||
def test_init_invalid_boolean(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterScaleInRequest,
|
||||
identity='foo', count=1, health_check="foo")
|
||||
self.assertEqual(
|
||||
"Unrecognized value 'foo', acceptable values are: '0', '1', "
|
||||
"'f', 'false', 'n', 'no', 'off', 'on', 't', 'true', 'y', 'yes'",
|
||||
six.text_type(ex))
|
||||
|
||||
|
||||
class TestClusterScaleOut(test_base.SenlinTestCase):
|
||||
|
||||
|
@ -418,6 +443,9 @@ class TestClusterScaleOut(test_base.SenlinTestCase):
|
|||
self.assertEqual('foo', sot.identity)
|
||||
self.assertEqual(5, sot.count)
|
||||
|
||||
sot.obj_set_defaults()
|
||||
self.assertFalse(sot.health_check)
|
||||
|
||||
def test_init_failed(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterScaleOutRequest,
|
||||
|
@ -425,6 +453,15 @@ class TestClusterScaleOut(test_base.SenlinTestCase):
|
|||
self.assertEqual("Value must be >= 0 for field 'count'.",
|
||||
six.text_type(ex))
|
||||
|
||||
def test_init_invalid_boolean(self):
|
||||
ex = self.assertRaises(ValueError,
|
||||
clusters.ClusterScaleOutRequest,
|
||||
identity='foo', count=1, health_check="foo")
|
||||
self.assertEqual(
|
||||
"Unrecognized value 'foo', acceptable values are: '0', '1', "
|
||||
"'f', 'false', 'n', 'no', 'off', 'on', 't', 'true', 'y', 'yes'",
|
||||
six.text_type(ex))
|
||||
|
||||
|
||||
class TestClusterAttachPolicy(test_base.SenlinTestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue