rbd: adapt to GetVolumeByID error message

GetVolumeByID already returning detailed
error message, the caller just need to return
it. No need to add duplicate details to error
message.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2024-07-30 18:37:40 +02:00
committed by mergify[bot]
parent 7e2e5ba2e5
commit 8788e5ec08
2 changed files with 20 additions and 52 deletions

View File

@ -27,6 +27,7 @@ import (
corerbd "github.com/ceph/ceph-csi/internal/rbd"
"github.com/ceph/ceph-csi/internal/rbd/types"
"github.com/ceph/ceph-csi/internal/util"
librbd "github.com/ceph/go-ceph/rbd"
"github.com/ceph/go-ceph/rbd/admin"
@ -594,6 +595,16 @@ func TestGetGRPCError(t *testing.T) {
err: nil,
expectedErr: status.Error(codes.OK, "ok string"),
},
{
name: "ErrImageNotFound",
err: corerbd.ErrImageNotFound,
expectedErr: status.Error(codes.NotFound, corerbd.ErrImageNotFound.Error()),
},
{
name: "ErrPoolNotFound",
err: util.ErrPoolNotFound,
expectedErr: status.Error(codes.NotFound, util.ErrPoolNotFound.Error()),
},
}
for _, tt := range tests {