code: def test_hash_recalculation(mocker, dvc, tmp_dir, local_remote):
      tmp_dir.gen({"foo": "foo"})
      test_file_md5 = mocker.spy(dvc_data.hashfile.hash, "file_md5")
      ret = main(["config", "cache.type", "hardlink"])
      assert ret == 0
      ret = main(["add", "foo"])
      assert ret == 0
      ret = main(["push"])
      assert ret == 0
      assert test_file_md5.mock.call_count == 3
  
imports: import logging
  import os
  import shutil
  import pytest
  from flaky.flaky_decorator import flaky
  import dvc_data
  from dvc.cli import main
  from dvc.exceptions import CheckoutError
  from dvc.repo.open_repo import clean_repos
  from dvc.stage.exceptions import StageNotFound
  from dvc.testing.remote_tests import TestRemote
  from dvc.utils.fs import remove
  from dvc_data.hashfile.db import HashFileDB
  from dvc_data.hashfile.db.local import LocalHashFileDB
  from dvc_data.hashfile.hash_info import HashInfo
label_desc: Use image node_id 4 for calling a global function with example usage: test_hash_recalculation(mocker, dvc, tmp_dir, local_remote) without return types