Пример #1
0
 def test_send_header_application_type(self):
     sid, message = base.generate_unique_message()
     headers = {'X-Application-Type': 'application-type-test'}
     response = self._run_and_wait(sid, message, headers=headers,
                                   version="v2")
     self.assertEqual('application-type-test',
                      response[0]['_source']['component'])
Пример #2
0
 def test_send_header_dimensions(self):
     sid, message = base.generate_unique_message()
     headers = {'X-Dimensions':
                'server:WebServer01,environment:production'}
     response = self._run_and_wait(sid, message, headers=headers,
                                   version="v2")
     self.assertEqual('production', response[0]['_source']['environment'])
     self.assertEqual('WebServer01', response[0]['_source']['server'])
Пример #3
0
 def test_send_header_application_type(self):
     sid, message = base.generate_unique_message()
     headers = {'X-Application-Type': 'application-type-test'}
     response = self._run_and_wait(sid,
                                   message,
                                   headers=headers,
                                   version="v2")
     self.assertEqual('application-type-test',
                      response[0]['_source']['component'])
Пример #4
0
 def test_send_header_dimensions(self):
     sid, message = base.generate_unique_message()
     headers = {'X-Dimensions': 'server:WebServer01,environment:production'}
     response = self._run_and_wait(sid,
                                   message,
                                   headers=headers,
                                   version="v2")
     self.assertEqual('production', response[0]['_source']['environment'])
     self.assertEqual('WebServer01', response[0]['_source']['server'])
Пример #5
0
    def test_should_accept_message_but_reject_after_adding_metadata(self):
        _, message = base.generate_unique_message(
            size=base._get_message_size(0.9999))
        headers = base._get_headers(self.logs_client.get_headers())
        data = base._get_data(message)

        try:
            self.logs_client.send_single_log(data, headers)
        except exceptions.ServerFault as urc:
            self.assertEqual(500, urc.resp.status)
            msg = urc.resp_body.get('title', None)
            # in Java that is under message
            if msg is None:
                msg = urc.resp_body.get('message', None)
            self.assertIsNotNone(msg, 'Should get status message')
            self.assertEqual('Envelope size exceeded', msg)
            return

        self.assertTrue(False, 'API should respond with 500')