diff --git a/tests/covalent_tests/cloud_resource_manager/core_test.py b/tests/covalent_tests/cloud_resource_manager/core_test.py index d52875ef1..b9b0f2ab0 100644 --- a/tests/covalent_tests/cloud_resource_manager/core_test.py +++ b/tests/covalent_tests/cloud_resource_manager/core_test.py @@ -41,6 +41,18 @@ def executor_module_path(): return "test_executor_module_path" +@pytest.fixture +def executor_infra_defaults(): + from pydantic import BaseModel + + class FakeExecutorInfraDefaults(BaseModel): + string_param: str = "fake_address_123" + number_param: int = 123 + sequence_param: tuple = (1, 2, 3) + + return FakeExecutorInfraDefaults + + @pytest.fixture def crm(mocker, executor_name, executor_module_path): mocker.patch( @@ -377,7 +389,9 @@ def test_get_tf_statefile_path(mocker, crm, executor_name): (False, {"test_key": "test_value"}), ], ) -def test_up(mocker, dry_run, executor_options, executor_name, executor_module_path): +def test_up( + mocker, dry_run, executor_options, executor_name, executor_module_path, executor_infra_defaults +): """ Unit test for CloudResourceManager.up() method """ @@ -420,10 +434,6 @@ def test_up(mocker, dry_run, executor_options, executor_name, executor_module_pa "covalent.cloud_resource_manager.core.CloudResourceManager._update_config", ) - mock_convert_to_tfvar = mocker.patch( - "covalent.cloud_resource_manager.core.CloudResourceManager._convert_to_tfvar", - ) - if executor_options: with pytest.raises(SystemExit): CloudResourceManager( @@ -438,6 +448,9 @@ def test_up(mocker, dry_run, executor_options, executor_name, executor_module_pa options=executor_options, ) + # Override infra defaults with dummy values. + crm.ExecutorInfraDefaults = executor_infra_defaults + with mock.patch( "covalent.cloud_resource_manager.core.open", mock.mock_open(), @@ -471,8 +484,6 @@ def test_up(mocker, dry_run, executor_options, executor_name, executor_module_pa f"{crm.executor_tf_path}/{executor_name}.conf", ) - mock_convert_to_tfvar.assert_any_call() - def test_up_executor_options(mocker, executor_name, executor_module_path): """