code: def test_record_child_failure(self):
      trainer_log_dir = os.path.join(self.test_dir, "trainer", "0")
      os.makedirs(trainer_log_dir)
      trainer_error_file = os.path.join(trainer_log_dir, "error.json")
  
      with mock.patch.dict(
          os.environ, {"TORCHELASTIC_ERROR_FILE": self.test_error_file}
      ):
          with self.assertRaises(ChildFailedError) as cm:
              raise_child_failure_error_fn(
                  "trainer", trainer_error_file
              )
          pf = cm.exception.get_first_failure()[1]
          # compare worker error file with reply file and overridden error code
          expect = json.load(open(pf.error_file))
          expect["message"]["errorCode"] = pf.exitcode
          actual = json.load(open(self.test_error_file))
          self.assertTrue(
              json.dumps(expect, sort_keys=True),
              json.dumps(actual, sort_keys=True),
          )
  
imports: import json
  import os
  import shutil
  import signal
  import tempfile
  import unittest
  from unittest import mock
  from torch.distributed.elastic.multiprocessing.errors import ChildFailedError, ProcessFailure, record
  from torch.distributed.elastic.multiprocessing.errors.error_handler import ErrorHandler
label_desc: Use image node_id 15 for calling the ApiTest obj's underlying member method code with example usage: obj.test_record_child_failure() without return types