From 309b43b5a003cb3e888b10a6bf3732b0fb6369b7 Mon Sep 17 00:00:00 2001 From: Abhishek Chowdhry Date: Wed, 23 Jun 2021 20:36:49 +0530 Subject: [PATCH 1/4] Updating ITs for Redis Cache --- .../redis-cache/tests/integration/redis.go | 11 +++++++++-- .../osdu-r3-mvp/service_resources/output.tf | 18 ++++++++++++++++++ .../tests/integration/integration_test.go | 4 +++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go index 4ee32807..f0ebf514 100644 --- a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go +++ b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go @@ -50,9 +50,16 @@ func validateMinTLSVersion(t *testing.T, minTLSVersion string) { // validateResourceGroupCaches - Validate the caches within the resource group func validateResourceGroupCacheCount(t *testing.T, caches []string, expectedCacheName string) { - expectedResourceGroupCaches := []string{expectedCacheName} + contains := false - require.Equal(t, expectedResourceGroupCaches, caches, "The provisioned caches in the RG don't match the expected result") + for _, cache := range caches { + if (cache == expectedCacheName){ + contains = true + break + } + } + + require.True(t, contains, "The provisioned caches in the RG don't contain the expected cache") } // InspectProvisionedCache - Runs a suite of test assertions to validate that a provisioned redis cache diff --git a/infra/templates/osdu-r3-mvp/service_resources/output.tf b/infra/templates/osdu-r3-mvp/service_resources/output.tf index 207404cb..73234ee9 100644 --- a/infra/templates/osdu-r3-mvp/service_resources/output.tf +++ b/infra/templates/osdu-r3-mvp/service_resources/output.tf @@ -88,3 +88,21 @@ output "redis_primary_access_key" { output "redis_ssl_port" { value = module.redis_cache.ssl_port } + +output "redis_queue_name" { + description = "The name of the redis_queue" + value = module.redis_queue.name +} + +output "redis_queue_hostname" { + value = module.redis_queue.hostname +} + +output "redis_queue_primary_access_key" { + sensitive = true + value = module.redis_queue.primary_access_key +} + +output "redis_queue_ssl_port" { + value = module.redis_queue.ssl_port +} diff --git a/infra/templates/osdu-r3-mvp/service_resources/tests/integration/integration_test.go b/infra/templates/osdu-r3-mvp/service_resources/tests/integration/integration_test.go index 11598cac..8b8cb84e 100644 --- a/infra/templates/osdu-r3-mvp/service_resources/tests/integration/integration_test.go +++ b/infra/templates/osdu-r3-mvp/service_resources/tests/integration/integration_test.go @@ -39,10 +39,12 @@ func TestDataEnvironment(t *testing.T) { testFixture := infratests.IntegrationTestFixture{ GoTest: t, TfOptions: tfOptions, - ExpectedTfOutputCount: 13, + ExpectedTfOutputCount: 17, TfOutputAssertions: []infratests.TerraformOutputValidation{ redisIntegTests.InspectProvisionedCache("redis_name", "services_resource_group_name"), + redisIntegTests.InspectProvisionedCache("redis_queue_name", "services_resource_group_name"), redisIntegTests.CheckRedisWriteOperations("redis_hostname", "redis_primary_access_key", "redis_ssl_port"), + redisIntegTests.CheckRedisWriteOperations("redis_queue_hostname", "redis_queue_primary_access_key", "redis_queue_ssl_port"), appGatewayIntegTests.InspectAppGateway("services_resource_group_name", "appgw_name", "keyvault_secret_id"), }, } -- GitLab From 10a7d7d453b83fe9f733c0242c5d79fcf8c9ce1f Mon Sep 17 00:00:00 2001 From: Abhishek Chowdhry Date: Wed, 23 Jun 2021 20:46:40 +0530 Subject: [PATCH 2/4] Linting change --- .../providers/azure/redis-cache/tests/integration/redis.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go index f0ebf514..5d542f48 100644 --- a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go +++ b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go @@ -53,7 +53,7 @@ func validateResourceGroupCacheCount(t *testing.T, caches []string, expectedCach contains := false for _, cache := range caches { - if (cache == expectedCacheName){ + if (cache == expectedCacheName) { contains = true break } -- GitLab From f447dd5c94f27a9626bcf75a4e497f4700a1975e Mon Sep 17 00:00:00 2001 From: Abhishek Chowdhry Date: Wed, 23 Jun 2021 20:48:53 +0530 Subject: [PATCH 3/4] Linting changes --- .../azure/redis-cache/tests/integration/redis.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go index 5d542f48..afea1d60 100644 --- a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go +++ b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go @@ -53,15 +53,16 @@ func validateResourceGroupCacheCount(t *testing.T, caches []string, expectedCach contains := false for _, cache := range caches { - if (cache == expectedCacheName) { - contains = true - break - } + if cache == expectedCacheName { + contains = true + break + } } require.True(t, contains, "The provisioned caches in the RG don't contain the expected cache") } + // InspectProvisionedCache - Runs a suite of test assertions to validate that a provisioned redis cache // is operational. func InspectProvisionedCache(cacheOutputName string, resourceGroupOutputName string) func(t *testing.T, output infratests.TerraformOutput) { -- GitLab From e9f3fb974436aa071bd2a8324eb394758515735b Mon Sep 17 00:00:00 2001 From: Abhishek Chowdhry Date: Wed, 23 Jun 2021 20:51:43 +0530 Subject: [PATCH 4/4] Linting changess --- .../providers/azure/redis-cache/tests/integration/redis.go | 1 - 1 file changed, 1 deletion(-) diff --git a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go index afea1d60..ba5005c9 100644 --- a/infra/modules/providers/azure/redis-cache/tests/integration/redis.go +++ b/infra/modules/providers/azure/redis-cache/tests/integration/redis.go @@ -62,7 +62,6 @@ func validateResourceGroupCacheCount(t *testing.T, caches []string, expectedCach require.True(t, contains, "The provisioned caches in the RG don't contain the expected cache") } - // InspectProvisionedCache - Runs a suite of test assertions to validate that a provisioned redis cache // is operational. func InspectProvisionedCache(cacheOutputName string, resourceGroupOutputName string) func(t *testing.T, output infratests.TerraformOutput) { -- GitLab