code: def test_hydra_compose_and_dump(
      tmp_dir, params_repo, dvc, hydra_enabled, config_dir, config_name
  ):
      hydra_setup(
          tmp_dir,
          config_dir=config_dir or "conf",
          config_name=config_name or "config",
      )
  
      dvc.experiments.run()
      assert (tmp_dir / "params.yaml").parse() == {
          "foo": [{"bar": 1}, {"baz": 2}],
          "goo": {"bag": 3.0},
          "lorem": False,
      }
  
      with dvc.config.edit() as conf:
          if hydra_enabled:
              conf["hydra"]["enabled"] = True
          if config_dir is not None:
              conf["hydra"]["config_dir"] = config_dir
          if config_name is not None:
              conf["hydra"]["config_name"] = config_name
  
      dvc.experiments.run()
  
      if hydra_enabled:
          assert (tmp_dir / "params.yaml").parse() == {
              "db": {
                  "driver": "mysql",
                  "user": "omry",
                  "pass": "secret",
              },
          }
  
          dvc.experiments.run(params=["db=postgresql"])
          assert (tmp_dir / "params.yaml").parse() == {
              "db": {
                  "driver": "postgresql",
                  "user": "foo",
                  "pass": "bar",
                  "timeout": 10,
              }
          }
      else:
          assert (tmp_dir / "params.yaml").parse() == {
              "foo": [{"bar": 1}, {"baz": 2}],
              "goo": {"bag": 3.0},
              "lorem": False,
          }
  
file_path: dvc/tests/func/experiments/test_set_params.py
imports: import pytest
  from dvc.exceptions import InvalidArgumentError
  from tests.func.utils.test_hydra import hydra_setup
label_desc: Use image node_id 2 for calling a global function with example usage: test_hydra_compose_and_dump(tmp_dir, params_repo, dvc, hydra_enabled, config_dir, config_name) without return types