Skip to content

Commit

Permalink
update func tests
Browse files Browse the repository at this point in the history
Signed-off-by: sk593 <shruthikumar@microsoft.com>
  • Loading branch information
sk593 committed Jan 31, 2024
1 parent 771d35e commit d6f7fb5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/functional/shared/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) {
templateKindBicep := "bicep"
templateKindTerraform := "terraform"
resourceType := "Applications.Datastores/redisCaches"
file := "./test/functional/shared/resources/testdata/recipes/test-bicep-recipes/corerp-redis-recipe.bicep"
file := "testdata/corerp-redis-recipe.bicep"
target := fmt.Sprintf("br:ghcr.io/radius-project/dev/test-bicep-recipes/redis-recipe:%s", generateUniqueTag())

t.Run("Validate rad recipe register", func(t *testing.T) {
Expand Down Expand Up @@ -108,8 +108,8 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) {
t.Run("Validate rad recipe show", func(t *testing.T) {
output, err := cli.RecipeShow(ctx, envName, recipe1, resourceType)
require.NoError(t, err)
require.Contains(t, output, recipeName)
require.Contains(t, output, recipeTemplate)
require.Contains(t, output, recipe1)
require.Contains(t, output, envRecipeTemplateBicep)
require.Contains(t, output, resourceType)
require.Contains(t, output, "redisName")
require.Contains(t, output, "string")
Expand All @@ -118,7 +118,7 @@ func verifyRecipeCLI(ctx context.Context, t *testing.T, test shared.RPTest) {
t.Run("Validate rad recipe show - terraform recipe", func(t *testing.T) {
showRecipeName := "redistesttf"
moduleServer := strings.TrimPrefix(functional.GetTerraformRecipeModuleServerURL(), "moduleServer=")
showRecipeTemplate := fmt.Sprintf("%s/kubernetes-redis.zip", moduleServer)
showRecipeTemplate := fmt.Sprintf("%s/kubernetes-redis.zip//modules", moduleServer)
showRecipeResourceType := "Applications.Datastores/redisCaches"
output, err := cli.RecipeRegister(ctx, envName, showRecipeName, "terraform", showRecipeTemplate, showRecipeResourceType, false)
require.NoError(t, err)
Expand Down
27 changes: 27 additions & 0 deletions test/functional/shared/cli/testdata/corerp-redis-recipe.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
param redisName string

resource redis 'Microsoft.Cache/redis@2022-06-01' = {
name: 'rds-${uniqueString(resourceGroup().id, redisName, deployment().name)}'
location: 'global'
properties: {
enableNonSslPort: false
minimumTlsVersion: '1.2'
sku: {
family: 'C'
capacity: 1
name: 'Basic'
}
}
}

output result object = {
values: {
host: redis.properties.hostName
port: redis.properties.port
}
secrets: {
connectionString: 'redis://${redis.properties.hostName}:${redis.properties.port}'
#disable-next-line outputs-should-not-contain-secrets
password: redis.listKeys().primaryKey
}
}

0 comments on commit d6f7fb5

Please sign in to comment.