Skip to content

Commit

Permalink
resource: default peername to local in list endpoints (#19340)
Browse files Browse the repository at this point in the history
  • Loading branch information
analogue authored Oct 23, 2023
1 parent ee2f046 commit 96606d1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions agent/grpc-external/services/resource/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func validateWildcardTenancy(tenancy *pbresource.Tenancy, namePrefix string) err
return status.Errorf(codes.InvalidArgument, "name_prefix invalid: must be lowercase alphanumeric, got: %v", namePrefix)
}

// TODO(spatel): NET-5475 - Remove as part of peer_name moving to PeerTenancy
if tenancy.PeerName == "" {
tenancy.PeerName = resource.DefaultPeerName
}

return nil
}

Expand Down
9 changes: 9 additions & 0 deletions agent/grpc-external/services/resource/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ func wildcardTenancyCases() map[string]struct {
PeerName: "local",
},
},
// TODO(spatel): NET-5475 - Remove as part of peer_name moving to PeerTenancy
"namespaced type with empty peername": {
typ: demo.TypeV2Artist,
tenancy: &pbresource.Tenancy{
Partition: resource.DefaultPartitionName,
Namespace: resource.DefaultNamespaceName,
PeerName: "",
},
},
"namespaced type with empty partition and namespace": {
typ: demo.TypeV2Artist,
tenancy: &pbresource.Tenancy{
Expand Down

0 comments on commit 96606d1

Please sign in to comment.