From 1577a407a7079c53d56090882de2b74ceb2e99b8 Mon Sep 17 00:00:00 2001 From: nithyatsu Date: Fri, 6 Sep 2024 18:58:04 -0700 Subject: [PATCH] add test for environment ID support Signed-off-by: nithyatsu --- pkg/cli/cmd/deploy/deploy_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pkg/cli/cmd/deploy/deploy_test.go b/pkg/cli/cmd/deploy/deploy_test.go index 91f9cc8fa14..30635aa8665 100644 --- a/pkg/cli/cmd/deploy/deploy_test.go +++ b/pkg/cli/cmd/deploy/deploy_test.go @@ -115,6 +115,30 @@ func Test_Validate(t *testing.T) { }, }, + { + Name: "rad deploy - valid with env ID", + Input: []string{"app.bicep", "-e", "/planes/radius/local/resourceGroups/test-resource-group/providers/applications.core/environments/prod"}, + ExpectedValid: true, + ConfigHolder: framework.ConfigHolder{ + ConfigFilePath: "", + Config: configWithWorkspace, + }, + ConfigureMocks: func(mocks radcli.ValidateMocks) { + mocks.ApplicationManagementClient.EXPECT(). + GetEnvironment(gomock.Any(), "/planes/radius/local/resourceGroups/test-resource-group/providers/applications.core/environments/prod"). + Return(v20231001preview.EnvironmentResource{ + ID: to.Ptr("/planes/radius/local/resourceGroups/test-resource-group/providers/applications.core/environments/prod"), + }, nil). + Times(1) + }, + ValidateCallback: func(t *testing.T, obj framework.Runner) { + runner := obj.(*Runner) + scope := "/planes/radius/local/resourceGroups/test-resource-group" + environmentID := scope + "/providers/applications.core/environments/prod" + require.Equal(t, scope, runner.Workspace.Scope) + require.Equal(t, environmentID, runner.Workspace.Environment) + }, + }, { Name: "rad deploy - valid with app and env", Input: []string{"app.bicep", "-e", "prod", "-a", "my-app"},