code: def test_pin_runtime_env_uri(
      start_cluster, source, expiration_s, monkeypatch
  ):
      """Test that temporary GCS URI references are deleted after expiration_s."""
      monkeypatch.setenv(
          RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_ENV_VAR,
          str(expiration_s),
      )
  
      cluster, address = start_cluster
  
      start = time.time()
      ray.init(
          address, namespace="test", runtime_env={"working_dir": source}
      )
  
      @ray.remote
      def f():
          pass
  
      # Wait for runtime env to be set up. This can be accomplished by getting
      # the result of a task that depends on it.
      ray.get(f.remote())
      ray.shutdown()
  
      # Need to re-connect to use internal_kv.
      ray.init(address=address)
  
      time_until_first_check = time.time() - start
      print(
          "Starting Internal KV checks at time ", time_until_first_check
      )
      assert (
          time_until_first_check < TEMP_URI_EXPIRATION_S
      ), "URI expired before we could check it. Try bumping the expiration time."
      if expiration_s > 0:
          assert not check_internal_kv_gced()
          wait_for_condition(
              check_internal_kv_gced, timeout=4 * expiration_s
          )
          time_until_gc = time.time() - start
          assert expiration_s < time_until_gc < 4 * expiration_s
          print("Internal KV was GC'ed at time ", time_until_gc)
      else:
          wait_for_condition(check_internal_kv_gced)
          print("Internal KV was GC'ed at time ", time.time() - start)
  
imports: import os
  import sys
  import tempfile
  import time
  from pathlib import Path
  from unittest import mock
  import pytest
  from pytest_lazyfixture import lazy_fixture
  import ray
  import ray.experimental.internal_kv
  from ray._private.ray_constants import RAY_RUNTIME_ENV_URI_PIN_EXPIRATION_S_ENV_VAR
  from ray._private.utils import get_directory_size_bytes
  from ray._private.test_utils import chdir, check_local_files_gced, wait_for_condition, find_free_port
label_desc: Use image node_id 7 for calling a global function with example usage: test_pin_runtime_env_uri(start_cluster, source, expiration_s, monkeypatch) without return types