code: def test_k8_sidecars(using_k8s: bool) -> None:
      if not using_k8s:
          pytest.skip("only need to run test on kubernetes")
  
      base_config = {
          "environment": {
              "pod_spec": {
                  "spec": {
                      "containers": [
                          {
                              "image": conf.TF1_CPU_IMAGE,
                              "name": "sidecar",
                              "command": ["/bin/bash"],
                          }
                      ]
                  }
              }
          }
      }
  
      def set_arg(arg: str) -> Dict[str, Any]:
          new_config = copy.deepcopy(base_config)
          new_config["environment"]["pod_spec"]["spec"]["containers"][
              0
          ]["args"] = ["-c", arg]
          return new_config
  
      configs = [set_arg("sleep 1; exit 1"), set_arg("sleep 99999999")]
      for config in configs:
          _run_cmd_with_config_expecting_failure(
              cmd="sleep 3; exit 1",
              expected_failure="exit code 1",
              config=config,
          )
  
          _run_cmd_with_config_expecting_success(
              cmd="sleep 3", config=config
          )
  
imports: import copy
  import re
  import subprocess
  import tempfile
  import time
  from pathlib import Path
  from typing import Any, Dict, List, Optional
  import docker
  import docker.errors
  import pytest
  from determined.common import util
  from tests import command
  from tests import config
  from tests.filetree import FileTree
label_desc: Use image node_id 22 for calling a global function with example usage: test_k8_sidecars(using_k8s) and returns: new_config