コード例 #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
ファイル: agent.py プロジェクト: gmr/consulate
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
ファイル: agent.py プロジェクト: gmr/consulate
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
ファイル: utils_tests.py プロジェクト: gmr/consulate
 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
ファイル: utils_tests.py プロジェクト: gmr/consulate
 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))