示例#1
0
    def __init__(self,
                 rabbitmq_context,
                 name,
                 queue_name,
                 max_queue_size,
                 priority=Priority.NORMAL,
                 timeout=None,
                 num_attempts=4,
                 seconds_between_attempts=2,
                 group=None,
                 ignore_connection_failure=False):
        """Creates a RabbitMqValidation object."""
        Validation.__init__(
            self,
            ("queue '{0}' should have less than {1} messages in in " +
             "it on RabbitMQ host: '{2}' ({3})").format(
                 queue_name, max_queue_size, rabbitmq_context.host, name),
            priority=priority,
            timeout=timeout,
            group=group)

        self.rabbitmq_context = rabbitmq_context
        self.max_queue_size = max_queue_size
        self.queue_name = queue_name
        self.num_attempts = num_attempts
        self.seconds_between_attempts = seconds_between_attempts
        self.ignore_connection_failure = ignore_connection_failure
示例#2
0
    def __init__(self,
                 method,
                 url,
                 data=None,
                 headers=None,
                 priority=Priority.NORMAL,
                 timeout=None,
                 group=None,
                 retries=1,
                 ignore_ssl_cert_errors=False,
                 auth=None):
        """Creates an HttpValidation object that will make an HTTP request to
        the provided URL passing the provided headers.

        """
        Validation.__init__(self,
                            "{0} {1}".format(method, url),
                            priority=priority,
                            timeout=timeout,
                            group=group)

        self._url = url
        self._data = data
        self._method = method
        self._headers = copy.copy(headers) or {}
        self._response_code_expectation = _ExpectedStatusCodes(set([200]))
        self._expectations = []
        self._retries = retries
        self._ignore_ssl_cert_errors = ignore_ssl_cert_errors
        self._auth = auth or ()
        self._elapsed_time = -1
示例#3
0
 def __init__(self, context, name, metric_name,
              time_range=datetime.timedelta(hours=1),
              **kwargs):
     """Creates a GraphiteValidation object"""
     Validation.__init__(self, name, **kwargs)
     self._context = context
     self.time_range = time_range
     self.metric_name = metric_name
     self._expectations = []
示例#4
0
 def __init__(self, context, name, metric_name,
              time_range=datetime.timedelta(hours=1),
              **kwargs):
     """Creates a GraphiteValidation object"""
     Validation.__init__(self, name, **kwargs)
     self._context = context
     self.time_range = time_range
     self.metric_name = metric_name
     self._expectations = []
示例#5
0
 def __init__(self, ssh_context, name,
              priority=Priority.NORMAL, timeout=None,
              group=None, connection_retries=0,
              hosts=None):
     """Creates an SshValidation object"""
     Validation.__init__(self,
         name, priority, timeout, group=group)
     self.context = ssh_context
     if hosts is not None:
         self.hosts = hosts
     else:
         self.hosts = []
     self.expectations = []
     self.retries = connection_retries
     self._exit_code_expectation = _ExitCodeEquals(self, 0)
示例#6
0
    def __init__(self, rabbitmq_context, name, queue_name, max_queue_size,
                 priority=Priority.NORMAL, timeout=None, num_attempts=4,
                 seconds_between_attempts=2, group=None,
                 ignore_connection_failure=False):
        """Creates a RabbitMqValidation object."""
        Validation.__init__(self,
            ("queue '{0}' should have less than {1} messages in in " +
            "it on RabbitMQ host: '{2}' ({3})")
            .format(queue_name, max_queue_size, rabbitmq_context.host, name),
            priority=priority, timeout=timeout, group=group)

        self.rabbitmq_context = rabbitmq_context
        self.max_queue_size = max_queue_size
        self.queue_name = queue_name
        self.num_attempts = num_attempts
        self.seconds_between_attempts = seconds_between_attempts
        self.ignore_connection_failure = ignore_connection_failure
示例#7
0
 def __init__(self,
              ssh_context,
              name,
              priority=Priority.NORMAL,
              timeout=None,
              group=None,
              connection_retries=0,
              hosts=None):
     """Creates an SshValidation object"""
     Validation.__init__(self, name, priority, timeout, group=group)
     self.context = ssh_context
     if hosts is not None:
         self.hosts = hosts
     else:
         self.hosts = []
     self.expectations = []
     self.retries = connection_retries
     self._exit_code_expectation = _ExitCodeEquals(self, 0)
示例#8
0
    def __init__(self, method, url, data=None, headers=None,
                 priority=Priority.NORMAL, timeout=None,
                 group=None, retries=1, ignore_ssl_cert_errors=False,
                 auth=None):
        """Creates an HttpValidation object that will make an HTTP request to
        the provided URL passing the provided headers.

        """
        Validation.__init__(self, "{0} {1}".format(method, url),
                            priority=priority,
                            timeout=timeout,
                            group=group)

        self._url = url
        self._data = data
        self._method = method
        self._headers = copy.copy(headers) or {}
        self._response_code_expectation = _ExpectedStatusCodes(set([200]))
        self._expectations = []
        self._retries = retries
        self._ignore_ssl_cert_errors = ignore_ssl_cert_errors
        self._auth = auth or ()
        self._elapsed_time = -1