From 4dcb29a7a8a62e86c123e66da838cf52c00c5feb Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 4 Aug 2025 15:48:05 +0100 Subject: [PATCH 1/3] Install terraform required to run tests Terraform binary is required for CI to pass. --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47c5cc39..626101b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,8 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - uses: hashicorp/setup-terraform@v3 + - uses: actions/setup-python@v4 id: setup-python with: From 58cb78a46b99318b2b4312787f5ea984f13d62a9 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 4 Aug 2025 15:56:26 +0100 Subject: [PATCH 2/3] Mock terraform output --- tests/test_runners/test_azure_runner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_runners/test_azure_runner.py b/tests/test_runners/test_azure_runner.py index a62478d2..5a5c6665 100644 --- a/tests/test_runners/test_azure_runner.py +++ b/tests/test_runners/test_azure_runner.py @@ -183,6 +183,7 @@ def test_provision(matcha_testing_directory: str, template_runner: AzureRunner): template_runner._validate_terraform_config = MagicMock() template_runner._initialize_terraform = MagicMock() template_runner._apply_terraform = MagicMock() + template_runner.tfs.terraform_client.output = MagicMock(wraps=mock_output) os.makedirs(os.path.join(matcha_testing_directory, ".matcha", "infrastructure")) From a458dd113bc911eb53ea938cad862a67c6f47b87 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 4 Aug 2025 15:59:26 +0100 Subject: [PATCH 3/3] Add missing argument --- tests/test_runners/test_azure_runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_runners/test_azure_runner.py b/tests/test_runners/test_azure_runner.py index 5a5c6665..5ef10a46 100644 --- a/tests/test_runners/test_azure_runner.py +++ b/tests/test_runners/test_azure_runner.py @@ -171,12 +171,16 @@ def test_remove_matcha_dir(matcha_testing_directory: str, template_runner: Azure assert not os.path.exists(matcha_dir) -def test_provision(matcha_testing_directory: str, template_runner: AzureRunner): +def test_provision( + matcha_testing_directory: str, + template_runner: AzureRunner, + mock_output: Callable[[str, bool], Union[str, Dict[str, str]]],): """Test service can provision resources using terraform. Args: matcha_testing_directory (str): Testing directory template_runner (AzureRunner): a AzureRunner object instance + mock_output (Callable[[str, bool], Union[str, Dict[str, str]]]): the mock output """ os.chdir(matcha_testing_directory) template_runner._check_terraform_installation = MagicMock()