From 7847615cb38515810ac433e2a386d0443881329e Mon Sep 17 00:00:00 2001 From: mishrapratikshya Date: Fri, 20 Jan 2023 16:55:41 -0800 Subject: [PATCH 1/5] fix flaky recipe parameter test by removing constant resource name --- azure-pipelines.yml | 1 + test/functional/corerp/resources/mongodb_test.go | 9 +++++---- .../corerp-resources-mongodb-recipe-parameters.bicep | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 549c03698c..3e306f025b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -206,6 +206,7 @@ stages: INTEGRATION_TEST_SP_APP_ID: $(INTEGRATION_TEST_SP_APP_ID) INTEGRATION_TEST_TENANT_ID: $(INTEGRATION_TEST_TENANT_ID) INTEGRATION_TEST_SP_PASSWORD: $(INTEGRATION_TEST_SP_PASSWORD) + INTEGRATION_TEST_RESOURCE_GROUP_NAME: $(INTEGRATION_TEST_RESOURCE_GROUP_NAME) AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID) AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY) AWS_REGION: $(AWS_REGION) diff --git a/test/functional/corerp/resources/mongodb_test.go b/test/functional/corerp/resources/mongodb_test.go index 27111c6a8b..604193a6ae 100644 --- a/test/functional/corerp/resources/mongodb_test.go +++ b/test/functional/corerp/resources/mongodb_test.go @@ -6,6 +6,7 @@ package resource_test import ( + "os" "testing" "github.com/project-radius/radius/pkg/resourcemodel" @@ -111,8 +112,6 @@ func Test_MongoDBUserSecrets(t *testing.T) { // the creation of a mongoDB from recipe // container using the mongoDB link to connect to the mongoDB resource func Test_MongoDB_Recipe(t *testing.T) { - t.Skip("This test is flaky, see issue: https://github.com/project-radius/radius/issues/4992") - template := "testdata/corerp-resources-mongodb-recipe.bicep" name := "corerp-resources-mongodb-recipe" appNamespace := "corerp-resources-mongodb-recipe-app" @@ -221,6 +220,8 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { template := "testdata/corerp-resources-mongodb-recipe-parameters.bicep" name := "corerp-resources-mongodb-recipe-parameters" appNamespace := "corerp-resources-mongodb-recipe-param-app" + documentdbName := "account-developer-parameters" + os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") + mongodbName := "mongodb-developer-parameters" + os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{ { @@ -249,12 +250,12 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosAccount, - Identity: "account-developer-parameters", + Identity: documentdbName, }, { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosDBMongo, - Identity: "mongodb-developer-parameters", + Identity: mongodbName, }, }, }, diff --git a/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep b/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep index cd5ade555c..cd2f0a2ae0 100644 --- a/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep +++ b/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep @@ -77,8 +77,8 @@ resource recipedb 'Applications.Link/mongoDatabases@2022-03-15-privatepreview' = recipe: { name: 'mongodb' parameters: { - documentdbName: 'account-developer-parameters' - mongodbName: 'mongodb-developer-parameters' + documentdbName: 'account-developer-parameters-${rg}' + mongodbName: 'mongodb-developer-parameters-${rg}' } } } From 6c9b0f3cb43bac094bab55773f179175f5596ba1 Mon Sep 17 00:00:00 2001 From: mishrapratikshya Date: Fri, 20 Jan 2023 19:15:01 -0800 Subject: [PATCH 2/5] temp:Add log line to check the failure --- test/functional/corerp/resources/mongodb_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/functional/corerp/resources/mongodb_test.go b/test/functional/corerp/resources/mongodb_test.go index 604193a6ae..8d0aea964e 100644 --- a/test/functional/corerp/resources/mongodb_test.go +++ b/test/functional/corerp/resources/mongodb_test.go @@ -6,6 +6,7 @@ package resource_test import ( + "fmt" "os" "testing" @@ -220,8 +221,16 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { template := "testdata/corerp-resources-mongodb-recipe-parameters.bicep" name := "corerp-resources-mongodb-recipe-parameters" appNamespace := "corerp-resources-mongodb-recipe-param-app" - documentdbName := "account-developer-parameters" + os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") - mongodbName := "mongodb-developer-parameters" + os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") + rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") + // skip the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set + // for running locally + t.Logf("The resource group is %s", rg) + if rg == "" { + t.Skip() + } + documentdbName := "account-developer-parameters-" + rg + mongodbName := "mongodb-developer-parameters-" + rg + fmt.Println("documentdbName - ", documentdbName) test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{ { From 189be40ad4ccfe4de52d8ed9a1c70a280ee49929 Mon Sep 17 00:00:00 2001 From: mishrapratikshya Date: Fri, 20 Jan 2023 20:48:49 -0800 Subject: [PATCH 3/5] removed debug logs --- test/functional/corerp/resources/mongodb_test.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/functional/corerp/resources/mongodb_test.go b/test/functional/corerp/resources/mongodb_test.go index 8d0aea964e..f7fc7b6857 100644 --- a/test/functional/corerp/resources/mongodb_test.go +++ b/test/functional/corerp/resources/mongodb_test.go @@ -6,7 +6,6 @@ package resource_test import ( - "fmt" "os" "testing" @@ -223,14 +222,10 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { appNamespace := "corerp-resources-mongodb-recipe-param-app" rg := os.Getenv("INTEGRATION_TEST_RESOURCE_GROUP_NAME") // skip the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set - // for running locally - t.Logf("The resource group is %s", rg) + // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup if rg == "" { t.Skip() } - documentdbName := "account-developer-parameters-" + rg - mongodbName := "mongodb-developer-parameters-" + rg - fmt.Println("documentdbName - ", documentdbName) test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{ { @@ -259,12 +254,12 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosAccount, - Identity: documentdbName, + Identity: "account-developer-parameters-" + rg, }, { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosDBMongo, - Identity: mongodbName, + Identity: "mongodb-developer-parameters-" + rg, }, }, }, From bcd1ba8281e999039c06f1c9bd54408408e6432d Mon Sep 17 00:00:00 2001 From: mishrapratikshya Date: Fri, 20 Jan 2023 21:41:59 -0800 Subject: [PATCH 4/5] add the skip message --- test/functional/corerp/resources/mongodb_test.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/functional/corerp/resources/mongodb_test.go b/test/functional/corerp/resources/mongodb_test.go index 6b9e51590d..ff1205c693 100644 --- a/test/functional/corerp/resources/mongodb_test.go +++ b/test/functional/corerp/resources/mongodb_test.go @@ -224,11 +224,9 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { // skip the test if INTEGRATION_TEST_RESOURCE_GROUP_NAME is not set // for running locally set the INTEGRATION_TEST_RESOURCE_GROUP_NAME with the test resourceGroup if rg == "" { - t.Skip() + t.Skip("This test needs the env variable INTEGRATION_TEST_RESOURCE_GROUP_NAME to be set") } - t.Skip("This test is flaky, see issue: https://github.com/project-radius/radius/issues/4992") - test := corerp.NewCoreRPTest(t, name, []corerp.TestStep{ { Executor: step.NewDeployExecutor(template, functional.GetMagpieImage()), From 147d858ba2dbe8d045b0c5438e6c2500da72608c Mon Sep 17 00:00:00 2001 From: mishrapratikshya Date: Fri, 20 Jan 2023 22:33:27 -0800 Subject: [PATCH 5/5] FIX: The name of account should be less than 44 --- test/functional/corerp/resources/mongodb_test.go | 8 ++++---- .../corerp-resources-mongodb-recipe-parameters.bicep | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/functional/corerp/resources/mongodb_test.go b/test/functional/corerp/resources/mongodb_test.go index ff1205c693..d2d961fc8c 100644 --- a/test/functional/corerp/resources/mongodb_test.go +++ b/test/functional/corerp/resources/mongodb_test.go @@ -242,7 +242,7 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { App: name, }, { - Name: "mcp-app-ctnr", + Name: "mdb-app-ctnr", Type: validation.ContainersResource, App: name, }, @@ -254,12 +254,12 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosAccount, - Identity: "account-developer-parameters-" + rg, + Identity: "acnt-developer-" + rg, }, { Provider: resourcemodel.ProviderAzure, LocalID: outputresource.LocalIDAzureCosmosDBMongo, - Identity: "mongodb-developer-parameters-" + rg, + Identity: "mdb-developer-" + rg, }, }, }, @@ -268,7 +268,7 @@ func Test_MongoDB_Recipe_Parameters(t *testing.T) { K8sObjects: &validation.K8sObjectSet{ Namespaces: map[string][]validation.K8sObject{ appNamespace: { - validation.NewK8sPodForResource(name, "mcp-app-ctnr"), + validation.NewK8sPodForResource(name, "mdb-app-ctnr"), }, }, }, diff --git a/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep b/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep index cd2f0a2ae0..162c7f6025 100644 --- a/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep +++ b/test/functional/corerp/resources/testdata/corerp-resources-mongodb-recipe-parameters.bicep @@ -44,7 +44,7 @@ resource app 'Applications.Core/applications@2022-03-15-privatepreview' = { } resource webapp 'Applications.Core/containers@2022-03-15-privatepreview' = { - name: 'mcp-app-ctnr' + name: 'mdb-app-ctnr' location: 'global' properties: { application: app.id @@ -77,8 +77,8 @@ resource recipedb 'Applications.Link/mongoDatabases@2022-03-15-privatepreview' = recipe: { name: 'mongodb' parameters: { - documentdbName: 'account-developer-parameters-${rg}' - mongodbName: 'mongodb-developer-parameters-${rg}' + documentdbName: 'acnt-developer-${rg}' + mongodbName: 'mdb-developer-${rg}' } } }