code: def test_run_tests_in_docker() -> None:
      inputs = []
  
      def _mock_popen(input: List[str]) -> None:
          inputs.append(" ".join(input))
  
      with mock.patch(
          "subprocess.Popen", side_effect=_mock_popen
      ), mock.patch(
          "ci.ray_ci.linux_tester_container.LinuxTesterContainer.install_ray",
          return_value=None,
      ):
          LinuxTesterContainer(
              "team",
              network="host",
              build_type="debug",
              test_envs=["ENV_01", "ENV_02"],
          )._run_tests_in_docker(
              ["t1", "t2"], [0, 1], "/tmp", ["v=k"], "flag"
          )
          input_str = inputs[-1]
          assert (
              "--env ENV_01 --env ENV_02 --env BUILDKITE" in input_str
          )
          assert "--network host" in input_str
          assert '--gpus "device=0,1"' in input_str
          assert "--volume /tmp:/tmp/bazel_event_logs" in input_str
          assert (
              "bazel test --jobs=1 --config=ci $(./ci/run/bazel_export_options) "
              "--config=ci-debug --test_env v=k --test_arg flag t1 t2"
              in input_str
          )
  
          LinuxTesterContainer("team")._run_tests_in_docker(
              ["t1", "t2"], [], "/tmp", ["v=k"]
          )
          input_str = inputs[-1]
          assert "--env BUILDKITE_BUILD_URL" in input_str
          assert "--gpus" not in input_str
  
imports: import json
  import os
  import platform
  import sys
  import pytest
  import tempfile
  from unittest import mock
  from typing import List, Optional
  from ci.ray_ci.linux_tester_container import LinuxTesterContainer
  from ci.ray_ci.utils import chunk_into_n
  from ci.ray_ci.container import _DOCKER_ECR_REPO, _RAYCI_BUILD_ID
label_desc: Use image node_id 2 for calling a global function with example usage: test_run_tests_in_docker() without return types