docstr: Simulate failing to download the working_dir from the GCS.
  
  Test that we raise an exception and don't hang.
docstr_tok: ["Simulate","failing","to","download","the","working_dir","from","the","GCS",".","Test","that","we","raise","an","exception","and","do","n't","hang","."]
code: def test_fail_download(
      self,
      tmpdir,
      monkeypatch,
      fail_download,
      start_cluster,
      plugin,
      client_connection_timeout_1s,
  ):
      """Simulate failing to download the working_dir from the GCS.
  
      Test that we raise an exception and don't hang.
      """
      _, address = start_cluster
      if plugin == "working_dir":
          runtime_env = {"working_dir": str(tmpdir)}
      else:
          runtime_env = {"py_modules": [str(tmpdir)]}
  
      def init_ray():
          ray.init(address, runtime_env=runtime_env)
  
      if using_ray_client(address):
          # Fails at ray.init() because the working_dir is downloaded for the
          # Ray Client server.
          with pytest.raises(ConnectionAbortedError) as e:
              init_ray()
          assert "Failed to download" in str(e.value)
          assert (
              f"the default is {RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT}"
          ) in str(e.value)
      else:
          init_ray()
          # TODO(architkulkarni): After #25972 is resolved, we should raise an
          # exception in ray.init().  Until then, we need to `ray.get` a task
          # to raise the exception.
  
          @ray.remote
          def f():
              pass
  
          with pytest.raises(RuntimeEnvSetupError) as e:
              ray.get(f.remote())
          assert "Failed to download" in str(e.value)
          assert (
              f"the default is {RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT}"
          ) in str(e.value)
  
file_path: ray/python/ray/tests/test_runtime_env_failure.py
imports: import os
  from unittest import mock
  import pytest
  from ray._private.ray_constants import RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_DEFAULT
  from ray._private.runtime_env.packaging import RAY_RUNTIME_ENV_FAIL_DOWNLOAD_FOR_TESTING_ENV_VAR, RAY_RUNTIME_ENV_FAIL_UPLOAD_FOR_TESTING_ENV_VAR
  import ray
  from ray.exceptions import RuntimeEnvSetupError
label_desc: Use image node_id 2 for calling the TestRuntimeEnvFailure obj's underlying member method code with example usage: obj.test_fail_download(tmpdir, monkeypatch, fail_download, start_cluster, plugin, client_connection_timeout_1s) without return types