From e6fce2ffc29d6d52b19fa277e41a6c8df8009462 Mon Sep 17 00:00:00 2001 From: Will Gibson <8738245+WillGibson@users.noreply.github.com> Date: Thu, 24 Oct 2024 11:12:55 +0100 Subject: [PATCH] Initial test changes to make them run at all without being logged into AWS --- extensions/tests/unit.tftest.hcl | 12 ++++++------ opensearch/tests/unit.tftest.hcl | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/extensions/tests/unit.tftest.hcl b/extensions/tests/unit.tftest.hcl index b268a8462..26572884d 100644 --- a/extensions/tests/unit.tftest.hcl +++ b/extensions/tests/unit.tftest.hcl @@ -43,6 +43,8 @@ mock_provider "aws" { alias = "domain-cdn" } +mock_provider "aws" {} + override_data { target = module.opensearch["test-opensearch"].data.aws_vpc.vpc values = { @@ -61,41 +63,39 @@ override_data { run "aws_ssm_parameter_unit_test" { command = plan + # Configuration assert { condition = aws_ssm_parameter.addons.name == "/copilot/applications/test-application/environments/test-environment/addons" error_message = "Invalid config for aws_ssm_parameter name" } - assert { condition = aws_ssm_parameter.addons.tier == "Intelligent-Tiering" error_message = "Intelligent-Tiering not enabled, parameters > 4096 characters will be rejected" } - assert { condition = aws_ssm_parameter.addons.type == "String" error_message = "Invalid config for aws_ssm_parameter type" } + # Value + + # Tags assert { condition = aws_ssm_parameter.addons.tags["application"] == "test-application" error_message = "" } - assert { condition = aws_ssm_parameter.addons.tags["copilot-application"] == "test-application" error_message = "" } - assert { condition = aws_ssm_parameter.addons.tags["environment"] == "test-environment" error_message = "" } - assert { condition = aws_ssm_parameter.addons.tags["copilot-environment"] == "test-environment" error_message = "" } - assert { condition = aws_ssm_parameter.addons.tags["managed-by"] == "DBT Platform - Terraform" error_message = "" diff --git a/opensearch/tests/unit.tftest.hcl b/opensearch/tests/unit.tftest.hcl index 5f34d3134..c45650316 100644 --- a/opensearch/tests/unit.tftest.hcl +++ b/opensearch/tests/unit.tftest.hcl @@ -1,3 +1,5 @@ +mock_provider "aws" {} + override_data { target = data.aws_vpc.vpc values = {