diff --git a/pkg/cli/recipepack/recipepack.go b/pkg/cli/recipepack/recipepack.go index 6c4b31c522..f12cafc577 100644 --- a/pkg/cli/recipepack/recipepack.go +++ b/pkg/cli/recipepack/recipepack.go @@ -261,6 +261,10 @@ func GetCoreTypesRecipeInfo() []CoreTypesRecipeInfo { ResourceType: "Radius.Data/postgreSqlDatabases", Source: "ghcr.io/radius-project/kube-recipes/postgresqldatabases:" + resolveRecipeTag("Radius.Data/postgreSqlDatabases", isEdge), }, + { + ResourceType: "Radius.Data/redisCaches", + Source: "ghcr.io/radius-project/kube-recipes/rediscaches:" + resolveRecipeTag("Radius.Data/redisCaches", isEdge), + }, { ResourceType: "Radius.Messaging/rabbitMQ", Source: "ghcr.io/radius-project/kube-recipes/rabbitmq:" + resolveRecipeTag("Radius.Messaging/rabbitMQ", isEdge), diff --git a/pkg/cli/recipepack/recipepack_test.go b/pkg/cli/recipepack/recipepack_test.go index b429178f3c..925a698c5d 100644 --- a/pkg/cli/recipepack/recipepack_test.go +++ b/pkg/cli/recipepack/recipepack_test.go @@ -39,6 +39,7 @@ func Test_GetDefaultRecipePackDefinition(t *testing.T) { "Radius.Security/secrets", "Radius.Data/mySqlDatabases", "Radius.Data/postgreSqlDatabases", + "Radius.Data/redisCaches", "Radius.Messaging/rabbitMQ", } require.Len(t, definitions, len(expectedResourceTypes)) diff --git a/test/functional-portable/corerp/noncloud/resources/rediscache_test.go b/test/functional-portable/corerp/noncloud/resources/rediscache_test.go new file mode 100644 index 0000000000..41f1a49421 --- /dev/null +++ b/test/functional-portable/corerp/noncloud/resources/rediscache_test.go @@ -0,0 +1,68 @@ +/* +Copyright 2026 The Radius Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package resource_test + +import ( + "fmt" + "testing" + + "github.com/radius-project/radius/test/rp" + "github.com/radius-project/radius/test/step" + "github.com/radius-project/radius/test/validation" +) + +// Test_RedisCache deploys a Radius.Data/redisCaches resource using the default +// preview-environment recipe pack and validates the running Kubernetes resources +// provisioned by the Redis recipe. +func Test_RedisCache(t *testing.T) { + template := "testdata/corerp-resources-rediscache.bicep" + name := "corerp-resources-redis" + cacheName := "redis-cache" + + test := rp.NewRPTest(t, name, []rp.TestStep{ + { + RPResources: &validation.RPResourceSet{ + Resources: []validation.RPResource{ + { + Name: name, + Type: validation.CoreApplicationsResource, + }, + { + Name: cacheName, + Type: validation.DataRedisCachesResource, + App: name, + }, + }, + }, + K8sObjects: &validation.K8sObjectSet{ + Namespaces: map[string][]validation.K8sObject{ + name: { + validation.NewK8sPodForResource(name, cacheName), + validation.NewK8sDeploymentForResource(name, cacheName), + validation.NewK8sServiceForResource(name, cacheName), + }, + }, + }, + }, + }) + + preSetup, previewEnvID := rp.NewPreviewEnvPreSetup(name, test.Options.Workspace.Scope, name) + test.PreSetup = preSetup + test.Steps[0].Executor = step.NewDeployExecutor(template, fmt.Sprintf("environment=%s", previewEnvID)) + + test.Test(t) +} diff --git a/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-rediscache.bicep b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-rediscache.bicep new file mode 100644 index 0000000000..b6048c9a2e --- /dev/null +++ b/test/functional-portable/corerp/noncloud/resources/testdata/corerp-resources-rediscache.bicep @@ -0,0 +1,25 @@ +extension radius + +@description('Specifies the location for resources.') +param location string = 'global' + +@description('Specifies the environment for resources.') +param environment string + +resource app 'Radius.Core/applications@2025-08-01-preview' = { + name: 'corerp-resources-redis' + location: location + properties: { + environment: environment + } +} + +resource redis 'Radius.Data/redisCaches@2025-08-01-preview' = { + name: 'redis-cache' + location: location + properties: { + environment: environment + application: app.id + size: 'S' + } +} diff --git a/test/validation/shared.go b/test/validation/shared.go index 76468b1a5e..d05aee420f 100644 --- a/test/validation/shared.go +++ b/test/validation/shared.go @@ -57,6 +57,7 @@ const ( // Radius.Data resource types (new provider). DataMySQLDatabasesResource = "radius.data/mySqlDatabases" DataPostgreSQLDatabasesResource = "radius.data/postgreSqlDatabases" + DataRedisCachesResource = "radius.data/redisCaches" // Radius.Messaging resource types (new provider). MessagingRabbitMQResource = "radius.messaging/rabbitMQ"