Skip to content

Commit

Permalink
fix: error type on tenancy checks
Browse files Browse the repository at this point in the history
  • Loading branch information
JadhavPoonam committed Oct 24, 2023
1 parent e12b377 commit f67d523
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion agent/grpc-external/services/resource/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *Server) Read(ctx context.Context, req *pbresource.ReadRequest) (*pbreso
}

// Check tenancy exists for the V2 resource.
if err = tenancyExists(reg, s.TenancyBridge, req.Id.Tenancy, codes.NotFound); err != nil {
if err = tenancyExists(reg, s.TenancyBridge, req.Id.Tenancy, codes.InvalidArgument); err != nil {
return nil, err
}

Expand Down
20 changes: 10 additions & 10 deletions internal/tenancy/tenancytest/namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,6 @@ func TestReadNamespace_NotFound(t *testing.T) {
Build(),
errMsg: "resource not found",
},
{
name: "tenancy units: partition not present",
resource: rtest.Resource(pbtenancy.NamespaceType, "ns1").
WithTenancy(&pbresource.Tenancy{
Partition: "partition1",
}).
WithData(t, validNamespace()).
Build(),
errMsg: "partition not found: partition1",
},
}

for _, tc := range cases {
Expand Down Expand Up @@ -146,6 +136,16 @@ func TestReadNamespace_InvalidArgument(t *testing.T) {
Build(),
errMsg: fmt.Sprintf("partition scoped resource %s.%s.%s cannot have a namespace. got: ns2", pbtenancy.NamespaceType.Group, pbtenancy.NamespaceType.GroupVersion, pbtenancy.NamespaceType.Kind),
},
{
name: "tenancy units: partition not present",
resource: rtest.Resource(pbtenancy.NamespaceType, "ns1").
WithTenancy(&pbresource.Tenancy{
Partition: "partition1",
}).
WithData(t, validNamespace()).
Build(),
errMsg: "partition not found: partition1",
},
}

for _, tc := range cases {
Expand Down

0 comments on commit f67d523

Please sign in to comment.