Пример #1
0
def _validate_interval(value, model):
    """Validate that interval does not conflict with other attributes.

    :param str value: The interval value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    return utils.validate_go_interval(value) and not model.ttl
Пример #2
0
def _validate_interval(value, model):
    """Validate that interval does not conflict with other attributes.

    :param str value: The interval value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    return utils.validate_go_interval(value) and not model.ttl
Пример #3
0
def _validate_ttl(value, model):
    """Validate that the TTL does not conflict with other attributes.

    :param str value: The TTL value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    is_valid = utils.validate_go_interval(value)
    return is_valid and not model.args and not model.grpc and not model.http and not model.tcp and not model.interval
Пример #4
0
def _validate_ttl(value, model):
    """Validate that the TTL does not conflict with other attributes.

    :param str value: The TTL value
    :param consulate.models.agent.Check model: The model instance.
    :rtype: bool

    """
    return utils.validate_go_interval(value) and not model.args \
        and not model.grpc and not model.http \
        and not model.tcp and not model.interval
Пример #5
0
 def test_invalid_values(self):
     for value in {"100", "1 year", "5M", "30S"}:
         print("Testing {}".format(value))
         self.assertFalse(utils.validate_go_interval(value))
Пример #6
0
 def test_valid_values(self):
     for value in {"5µs", "300ms", "-1.5h", "2h45m", "5m", "30s"}:
         print("Testing {}".format(value))
         self.assertTrue(utils.validate_go_interval(value))
Пример #7
0
 def test_invalid_values(self):
     for value in {'100', '1 year', '5M', '30S'}:
         print('Testing {}'.format(value))
         self.assertFalse(utils.validate_go_interval(value))
Пример #8
0
 def test_valid_values(self):
     for value in {'5µs', '300ms', '-1.5h', '2h45m', '5m', '30s'}:
         print('Testing {}'.format(value))
         self.assertTrue(utils.validate_go_interval(value))
Пример #9
0
 def test_invalid_values(self):
     for value in {'100', '1 year', '5M', '30S'}:
         print('Testing {}'.format(value))
         self.assertFalse(utils.validate_go_interval(value))
Пример #10
0
 def test_valid_values(self):
     for value in {'5µs', '300ms', '-1.5h', '2h45m', '5m', '30s'}:
         print('Testing {}'.format(value))
         self.assertTrue(utils.validate_go_interval(value))