code: def test_sync_clients_max_attempts_transient_error(
      mocker, flow_or_deployment, protocol, port_generator
  ):
      if flow_or_deployment == "deployment" and protocol in [
          "websocket",
          "http",
      ]:
          return
      random_port = port_generator()
      client = Client(host=f"{protocol}://localhost:{random_port}")
      stop_event = multiprocessing.Event()
      start_event = multiprocessing.Event()
      t = multiprocessing.Process(
          target=_start_runtime,
          args=(
              protocol,
              random_port,
              flow_or_deployment,
              stop_event,
              start_event,
          ),
      )
      t.start()
      start_event.wait(5)
      try:
          # Test that a regular index request triggers the correct callbacks
          on_error_mock = mocker.Mock()
          response = _random_post_request(
              client, on_error_mock, use_stream=False
          )
          assert len(response) == 1
  
          on_error_mock.assert_not_called()
      finally:
          stop_event.set()
          t.join(5)
          t.terminate()
  
file_path: jina/tests/unit/clients/python/test_client_errors.py
imports: import multiprocessing
  import os
  import pytest
  from jina import Deployment, DocumentArray, Flow
  from jina.clients import Client
  from jina.clients.base.retry import wait_or_raise_err, sync_wait_or_raise_err
  from tests import random_docs
label_desc: Use image node_id 5 for calling a global function with example usage: test_sync_clients_max_attempts_transient_error(mocker, flow_or_deployment, protocol, port_generator) without return types