code: def test_log_location_and_metric_location_vars_snapshot_enabled():
      """
      Validates that metrics & non metrics related logs get saved in directory configured as per
       METRICS_LOCATION & LOG_LOCATION environment variables with snaphsot enabled.
      """
      test_utils.stop_torchserve()
      test_utils.delete_all_snapshots()
      os.environ["LOG_LOCATION"] = test_utils.ROOT_DIR
      os.environ["METRICS_LOCATION"] = test_utils.ROOT_DIR
      run_log_location_var(no_config_snapshots=False)
      run_metrics_location_var(no_config_snapshots=False)
      requests.post("http://127.0.0.1:8081/models?url=mnist.mar")
      # We stop torchserve again here so that we can remove the LOG_LOCATION & METRICS_LOCATION
      # setting from environment variable
      test_utils.stop_torchserve()
      del os.environ["LOG_LOCATION"]
      del os.environ["METRICS_LOCATION"]
      assert (
          len(
              glob.glob(
                  os.path.join(
                      test_utils.ROOT_DIR, "config", "*startup.cfg"
                  )
              )
          )
          >= 1
      )
      if platform.system() != "Windows":
          assert (
              len(
                  glob.glob(
                      os.path.join(
                          test_utils.ROOT_DIR, "config", "*shutdown.cfg"
                      )
                  )
              )
              >= 1
          )
      assert (
          len(
              glob.glob(
                  os.path.join(
                      test_utils.ROOT_DIR, "config", "*snap*.cfg"
                  )
              )
          )
          >= 1
      )
      for f in glob.glob(test_utils.ROOT_DIR + "*.log"):
          os.remove(f)
  
      shutil.rmtree(path.join(test_utils.ROOT_DIR, "config"))
  
imports: import glob
  import os
  import platform
  import shutil
  import time
  from os import path
  import requests
  import test_utils
label_desc: Use image node_id 18 for calling a global function with example usage: test_log_location_and_metric_location_vars_snapshot_enabled() without return types