Skip to content

Investigate client test failures in CI #2364

@xrmx

Description

@xrmx
=================================== FAILURES ===================================
_________ test_send_remote_failover_sync_non_transport_exception_error _________

should_try = <MagicMock name='should_try' id='139834764165200'>
http_send = <MagicMock name='send' id='139834781896864'>
caplog = <_pytest.logging.LogCaptureFixture object at 0x7f2dd1720080>

    @mock.patch("elasticapm.transport.http.Transport.send")
    @mock.patch("elasticapm.transport.base.TransportState.should_try")
    def test_send_remote_failover_sync_non_transport_exception_error(should_try, http_send, caplog):
        should_try.return_value = True
    
        client = Client(
            server_url="http://example.com/",
            service_name="app_name",
            secret_token="secret",
            transport_class="elasticapm.transport.http.Transport",
            metrics_interval="0ms",
            metrics_sets=[],
        )
        # test error
        http_send.side_effect = ValueError("oopsie")
        with caplog.at_level("ERROR", "elasticapm.transport"):
            client.capture_message("foo", handled=False)
>       client._transport.flush()

caplog     = <_pytest.logging.LogCaptureFixture object at 0x7f2dd1720080>
client     = <elasticapm.base.Client object at 0x7f2dd1721f10>
http_send  = <MagicMock name='send' id='139834781896864'>
should_try = <MagicMock name='should_try' id='139834764165200'>

tests/client/client_tests.py:294: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <elasticapm.transport.http.Transport object at 0x7f2dd28c87d0>

    def flush(self):
        """
        Trigger a flush of the queue.
        Note: this method will only return once the queue is empty. This means it can block indefinitely if more events
        are produced in other threads than can be consumed.
        """
        self.queue(None, None, flush=True)
        if not self._flushed.wait(timeout=self._max_flush_time_seconds):
>           raise ValueError("flush timed out")
E           ValueError: flush timed out

self       = <elasticapm.transport.http.Transport object at 0x7f2dd28c87d0>

elasticapm/transport/base.py:309: ValueError
---------------------------- Captured log teardown -----------------------------
ERROR    elasticapm.transport:base.py:322 Failed to submit message: 'HTTP 403: <HTML><HEAD>\n<TITLE>Access Denied</TITLE>\n</HEAD><BODY>\n<H1>Access Denied</H1>\n \nYou don\'t have permission to access "http&#58;&#47;&#47;example&#46;com&#47;intake&#47;v2&#47;events&#63;" on this server.<P>\nReference&#32;&#35;18&#46;5ca33017&#46;1753411671&#46;72f44999\n<P>https&#58;&#47;&#47;errors&#46;edgesuite&#46;net&#47;18&#46;5ca33017&#46;1753411671&#46;72f44999</P>\n</BODY>\n</HTML>\n'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions