Skip to content

Commit

Permalink
add test for environment ID support
Browse files Browse the repository at this point in the history
Signed-off-by: nithyatsu <[email protected]>
  • Loading branch information
nithyatsu committed Sep 7, 2024
1 parent 1e6bee3 commit 1577a40
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pkg/cli/cmd/deploy/deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 1577a40

Please sign in to comment.