From 87641419b6c7888e98459d1ac28a86a57c5235a8 Mon Sep 17 00:00:00 2001 From: Limor Lahiani Date: Sat, 3 Aug 2024 21:40:26 +0300 Subject: [PATCH] Configure AppConfig integration test against staging (#113) * configure integration test against staging --- infra/terraform/modules/tests/fake_secrets.tf | 4 ++-- infra/terraform/modules/tests/main.tf | 2 +- ...p_config_configuration_provider_integration_test.py | 4 ++-- .../configuration/tests/config/aws.dev.eu-west-1.json | 10 ++++++++++ .../configuration/tests/config/aws.dev.us-west-2.json | 10 ---------- .../tests/config/aws.staging.us-east-1.json | 10 ++++++++++ pyproject.toml | 3 +++ 7 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 packages/configuration/tests/config/aws.dev.eu-west-1.json delete mode 100644 packages/configuration/tests/config/aws.dev.us-west-2.json create mode 100644 packages/configuration/tests/config/aws.staging.us-east-1.json diff --git a/infra/terraform/modules/tests/fake_secrets.tf b/infra/terraform/modules/tests/fake_secrets.tf index 8c6b769..566f655 100644 --- a/infra/terraform/modules/tests/fake_secrets.tf +++ b/infra/terraform/modules/tests/fake_secrets.tf @@ -1,7 +1,7 @@ resource "aws_secretsmanager_secret" "fake_secret_plain" { name = "test/fake-secret-plain" - description = "Fake secret used in integration tests" + description = "Fake secret (plain text) used in integration tests" recovery_window_in_days = 0 tags = merge( @@ -19,7 +19,7 @@ resource "aws_secretsmanager_secret_version" "fake_secret_plain_value" { resource "aws_secretsmanager_secret" "fake_secret_pair" { name = "test/fake-secret-pair" - description = "Fake secret used in integration tests" + description = "Fake secret (key-value pair) used in integration tests" recovery_window_in_days = 0 diff --git a/infra/terraform/modules/tests/main.tf b/infra/terraform/modules/tests/main.tf index 3712817..2fdb03a 100644 --- a/infra/terraform/modules/tests/main.tf +++ b/infra/terraform/modules/tests/main.tf @@ -1,6 +1,6 @@ module "appconfig_app" { source = "../appconfig-app" - app_name = "test-service" + app_name = "test-appconfig-service" env_name = var.stage tags = var.tags } \ No newline at end of file diff --git a/packages/configuration/tests/app_config_configuration_provider_integration_test.py b/packages/configuration/tests/app_config_configuration_provider_integration_test.py index a8ca16b..9ba8841 100644 --- a/packages/configuration/tests/app_config_configuration_provider_integration_test.py +++ b/packages/configuration/tests/app_config_configuration_provider_integration_test.py @@ -46,8 +46,8 @@ def configuration_with_populated_secrets(): def service_env(): clear_service_environment() os.environ['PLATFORM'] = 'AWS' - os.environ['STAGE'] = 'dev' - os.environ['REGION'] = 'us-west-2' + os.environ['STAGE'] = 'staging' + os.environ['REGION'] = 'us-east-1' os.environ['SERVICE_NAME'] = 'test-appconfig' config_folder = os.path.join(pathlib.Path(__file__).parent.resolve(), 'config') diff --git a/packages/configuration/tests/config/aws.dev.eu-west-1.json b/packages/configuration/tests/config/aws.dev.eu-west-1.json new file mode 100644 index 0000000..4728139 --- /dev/null +++ b/packages/configuration/tests/config/aws.dev.eu-west-1.json @@ -0,0 +1,10 @@ +{ + "GooConfiguration": { + "int1": 1, + "str2": "2", + "secrets": { + "secret_plain": "secret:test/fake-secret-plain", + "secret_pair": "secret:test/fake-secret-pair" + } + } +} \ No newline at end of file diff --git a/packages/configuration/tests/config/aws.dev.us-west-2.json b/packages/configuration/tests/config/aws.dev.us-west-2.json deleted file mode 100644 index 0fb2977..0000000 --- a/packages/configuration/tests/config/aws.dev.us-west-2.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "GooConfiguration": { - "int1": 1, - "str2": "2", - "secrets": { - "secret_plain": "secret:test/app/fake-secret-plain", - "secret_pair": "secret:test/app/fake-secret-pair" - } - } -} \ No newline at end of file diff --git a/packages/configuration/tests/config/aws.staging.us-east-1.json b/packages/configuration/tests/config/aws.staging.us-east-1.json new file mode 100644 index 0000000..4728139 --- /dev/null +++ b/packages/configuration/tests/config/aws.staging.us-east-1.json @@ -0,0 +1,10 @@ +{ + "GooConfiguration": { + "int1": 1, + "str2": "2", + "secrets": { + "secret_plain": "secret:test/fake-secret-plain", + "secret_pair": "secret:test/fake-secret-pair" + } + } +} \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 90e76ff..d8e7b9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,9 @@ export = "poetry_plugin_export.plugins:ExportApplicationPlugin" # Note that due to how pytest handles test discovery, the order of paths matter. Changing the order can cause issues. [tool.pytest.ini_options] addopts = "--import-mode=importlib" +markers = [ + "integration: marks integration tests (deselect with '-m \"not integration\"')" +] pythonpath = [ "packages/configuration", "packages/environment",