Switch to using google.golang.org/protobuf rather than github.com/golang/protobuf
This commit is contained in:
@@ -22,7 +22,6 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
csirpc "github.com/kubernetes-csi/csi-lib-utils/rpc"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
@@ -74,10 +73,8 @@ func (s *snapshot) CreateSnapshot(ctx context.Context, snapshotName string, volu
|
||||
}
|
||||
|
||||
klog.V(5).Infof("CSI CreateSnapshot: %s driver name [%s] snapshot ID [%s] time stamp [%v] size [%d] readyToUse [%v]", snapshotName, driverName, rsp.Snapshot.SnapshotId, rsp.Snapshot.CreationTime, rsp.Snapshot.SizeBytes, rsp.Snapshot.ReadyToUse)
|
||||
creationTime, err := ptypes.Timestamp(rsp.Snapshot.CreationTime)
|
||||
if err != nil {
|
||||
return "", "", time.Time{}, 0, false, err
|
||||
}
|
||||
|
||||
creationTime := rsp.Snapshot.CreationTime.AsTime()
|
||||
return driverName, rsp.Snapshot.SnapshotId, creationTime, rsp.Snapshot.SizeBytes, rsp.Snapshot.ReadyToUse, nil
|
||||
}
|
||||
|
||||
@@ -138,9 +135,6 @@ func (s *snapshot) GetSnapshotStatus(ctx context.Context, snapshotID string, sna
|
||||
return false, time.Time{}, 0, fmt.Errorf("can not find snapshot for snapshotID %s", snapshotID)
|
||||
}
|
||||
|
||||
creationTime, err := ptypes.Timestamp(rsp.Entries[0].Snapshot.CreationTime)
|
||||
if err != nil {
|
||||
return false, time.Time{}, 0, err
|
||||
}
|
||||
creationTime := rsp.Entries[0].Snapshot.CreationTime.AsTime()
|
||||
return rsp.Entries[0].Snapshot.ReadyToUse, creationTime, rsp.Entries[0].Snapshot.SizeBytes, nil
|
||||
}
|
||||
|
@@ -25,7 +25,6 @@ import (
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/connection"
|
||||
"github.com/kubernetes-csi/csi-lib-utils/metrics"
|
||||
"github.com/kubernetes-csi/csi-test/v4/driver"
|
||||
@@ -33,6 +32,7 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -68,11 +68,8 @@ func createMockServer(t *testing.T) (*gomock.Controller, *driver.MockCSIDriver,
|
||||
func TestCreateSnapshot(t *testing.T) {
|
||||
defaultName := "snapshot-test"
|
||||
defaultID := "testid"
|
||||
createTimestamp := ptypes.TimestampNow()
|
||||
createTime, err := ptypes.Timestamp(createTimestamp)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to convert timestamp to time: %v", err)
|
||||
}
|
||||
createTimestamp := timestamppb.Now()
|
||||
createTime := createTimestamp.AsTime()
|
||||
|
||||
createSecrets := map[string]string{"foo": "bar"}
|
||||
defaultParameter := map[string]string{
|
||||
@@ -338,11 +335,8 @@ func TestDeleteSnapshot(t *testing.T) {
|
||||
func TestGetSnapshotStatus(t *testing.T) {
|
||||
defaultID := "testid"
|
||||
size := int64(1000)
|
||||
createTimestamp := ptypes.TimestampNow()
|
||||
createTime, err := ptypes.Timestamp(createTimestamp)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to convert timestamp to time: %v", err)
|
||||
}
|
||||
createTimestamp := timestamppb.Now()
|
||||
createTime := createTimestamp.AsTime()
|
||||
|
||||
defaultRequest := &csi.ListSnapshotsRequest{
|
||||
SnapshotId: defaultID,
|
||||
|
Reference in New Issue
Block a user