Skip to content

Commit

Permalink
Nexus changes (#368)
Browse files Browse the repository at this point in the history
* Hide namespace transfer until we support it.

* Make allow namespace creation optional during endpoint creation.
  • Loading branch information
nikki-dag authored Jul 12, 2024
1 parent 3a11b52 commit 579383f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 9 additions & 3 deletions app/nexus.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,12 @@ func NewNexusCommand(getNexusClientFn GetNexusClientFn) (CommandOut, error) {
Usage: "Namespace that is allowed to call this endpoint",
Required: true,
}
allowNamespaceFlagOptional := &cli.StringSliceFlag{
Name: allowNamespaceFlag.Name,
Aliases: allowNamespaceFlag.Aliases,
Usage: allowNamespaceFlag.Usage + " (optional)",
Required: false,
}
namespaceFlag := &cli.StringSliceFlag{
Name: "namespace",
Aliases: []string{"ns"},
Expand Down Expand Up @@ -386,7 +392,7 @@ func NewNexusCommand(getNexusClientFn GetNexusClientFn) (CommandOut, error) {
endpointDescriptionFileOptionalFlag,
targetNamespaceFlag,
targetTaskQueueFlag,
allowNamespaceFlag,
allowNamespaceFlagOptional,
RequestIDFlag,
},
Action: func(ctx *cli.Context) error {
Expand All @@ -400,7 +406,7 @@ func NewNexusCommand(getNexusClientFn GetNexusClientFn) (CommandOut, error) {
endpointDescription,
ctx.String(targetNamespaceFlag.Name),
ctx.String(targetTaskQueueFlag.Name),
ctx.StringSlice(allowNamespaceFlag.Name),
ctx.StringSlice(allowNamespaceFlagOptional.Name),
ctx.String(RequestIDFlag.Name),
)
if err != nil {
Expand All @@ -422,7 +428,7 @@ func NewNexusCommand(getNexusClientFn GetNexusClientFn) (CommandOut, error) {
endpointDescriptionOptionalFlag,
endpointDescriptionFileOptionalFlag,
unsetEndpointDescriptionOptionalFlag,
targetNamespaceFlagOptional,
// targetNamespaceFlagOptional, TODO: Uncomment when we support updating target namespace
targetTaskQueueFlagOptional,
ResourceVersionFlag,
RequestIDFlag,
Expand Down
8 changes: 4 additions & 4 deletions app/nexus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func (s *NexusTestSuite) TestEndpointUpdate() {
"--request-id", exampleEndpoint.AsyncOperationId,
))

// update target-namespace success
s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{getExampleNexusEndpoint()}}, nil).Times(1)
// update target-namespace success TODO: Uncomment when we support updating target namespace
/*s.mockCloudService.EXPECT().GetNexusEndpoints(gomock.Any(), gomock.Any()).Return(&cloudservice.GetNexusEndpointsResponse{Endpoints: []*nexus.Endpoint{getExampleNexusEndpoint()}}, nil).Times(1)
s.mockCloudService.EXPECT().UpdateNexusEndpoint(gomock.Any(), gomock.Any()).Return(&cloudservice.UpdateNexusEndpointResponse{
AsyncOperation: &operation.AsyncOperation{
Id: exampleEndpoint.AsyncOperationId,
Expand All @@ -241,7 +241,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() {
"--name", exampleEndpoint.Spec.Name,
"--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId+"-updated",
"--request-id", exampleEndpoint.AsyncOperationId,
))
))*/

// update description file success
path := "nexus_endpoint_description_test.md"
Expand Down Expand Up @@ -295,7 +295,7 @@ func (s *NexusTestSuite) TestEndpointUpdate() {
s.NoError(s.RunCmd("nexus", "endpoint", "update",
"--name", exampleEndpoint.Spec.Name,
"--description", exampleEndpoint.Spec.Description+"-updated",
"--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId+"-updated",
// "--target-namespace", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.NamespaceId+"-updated",
"--target-task-queue", exampleEndpoint.Spec.TargetSpec.WorkerTargetSpec.TaskQueue+"-updated",
"--request-id", exampleEndpoint.AsyncOperationId,
))
Expand Down

0 comments on commit 579383f

Please sign in to comment.