code: def test_jemalloc_env_var_propagate():
      """Test `propagate_jemalloc_env_var`"""
      gcs_ptype = ray._private.ray_constants.PROCESS_TYPE_GCS_SERVER
      """
      If the shared library path is not specified,
      it should return an empty dict.
      """
      expected = {}
      actual = ray._private.services.propagate_jemalloc_env_var(
          jemalloc_path="",
          jemalloc_conf="",
          jemalloc_comps=[],
          process_type=gcs_ptype,
      )
      assert actual == expected
      actual = ray._private.services.propagate_jemalloc_env_var(
          jemalloc_path=None,
          jemalloc_conf="a,b,c",
          jemalloc_comps=[
              ray._private.ray_constants.PROCESS_TYPE_GCS_SERVER
          ],
          process_type=gcs_ptype,
      )
      assert actual == expected
      """
      When the shared library is specified
      """
      library_path = "/abc"
      expected = {"LD_PRELOAD": library_path, "RAY_LD_PRELOAD": "1"}
      actual = ray._private.services.propagate_jemalloc_env_var(
          jemalloc_path=library_path,
          jemalloc_conf="",
          jemalloc_comps=[
              ray._private.ray_constants.PROCESS_TYPE_GCS_SERVER
          ],
          process_type=gcs_ptype,
      )
      assert actual == expected
  
      # comps should be a list type.
      with pytest.raises(AssertionError):
          ray._private.services.propagate_jemalloc_env_var(
              jemalloc_path=library_path,
              jemalloc_conf="",
              jemalloc_comps="ray._private.ray_constants.PROCESS_TYPE_GCS_SERVER,",
              process_type=gcs_ptype,
          )
  
      # When comps don't match the process_type, it should return an empty dict.
      expected = {}
      actual = ray._private.services.propagate_jemalloc_env_var(
          jemalloc_path=library_path,
          jemalloc_conf="",
          jemalloc_comps=[
              ray._private.ray_constants.PROCESS_TYPE_RAYLET
          ],
          process_type=gcs_ptype,
      )
      """
      When the malloc config is specified
      """
      library_path = "/abc"
      malloc_conf = "a,b,c"
      expected = {
          "LD_PRELOAD": library_path,
          "MALLOC_CONF": malloc_conf,
          "RAY_LD_PRELOAD": "1",
      }
      actual = ray._private.services.propagate_jemalloc_env_var(
          jemalloc_path=library_path,
          jemalloc_conf=malloc_conf,
          jemalloc_comps=[
              ray._private.ray_constants.PROCESS_TYPE_GCS_SERVER
          ],
          process_type=gcs_ptype,
      )
      assert actual == expected
  
imports: import mock
  import subprocess
  import sys
  import pytest
  import ray
  from ray._raylet import check_health
  from ray._private.test_utils import Semaphore, client_test_enabled, wait_for_condition, get_gcs_memory_used
  from ray.experimental.internal_kv import _internal_kv_list
label_desc: Use image node_id 6 for calling a global function with example usage: test_jemalloc_env_var_propagate() without return types