test(pubsublite): testing support for reservations
@@ -309,6 +309,18 @@ func (s *mockLiteServer) doOperationResponse(ctx context.Context, req interface{
return resp, nil
}
+func (s *mockLiteServer) doReservationResponse(ctx context.Context, req interface{}) (*pb.Reservation, error) {
+ retResponse, retErr := s.popGlobalVerifiers(req)
+ if retErr != nil {
+ return nil, retErr
+ }
+ resp, ok := retResponse.(*pb.Reservation)
+ if !ok {
+ return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse)
+ }
+ return resp, nil
+}
+
func (s *mockLiteServer) doEmptyResponse(ctx context.Context, req interface{}) (*emptypb.Empty, error) {
retResponse, retErr := s.popGlobalVerifiers(req)
if retErr != nil {
@@ -369,6 +381,22 @@ func (s *mockLiteServer) DeleteSubscription(ctx context.Context, req *pb.DeleteS
return s.doEmptyResponse(ctx, req)
}
+func (s *mockLiteServer) CreateReservation(ctx context.Context, req *pb.CreateReservationRequest) (*pb.Reservation, error) {
+ return s.doReservationResponse(ctx, req)
+}
+
+func (s *mockLiteServer) GetReservation(ctx context.Context, req *pb.GetReservationRequest) (*pb.Reservation, error) {
+ return s.doReservationResponse(ctx, req)
+}
+
+func (s *mockLiteServer) UpdateReservation(ctx context.Context, req *pb.UpdateReservationRequest) (*pb.Reservation, error) {
+ return s.doReservationResponse(ctx, req)
+}
+
+func (s *mockLiteServer) DeleteReservation(ctx context.Context, req *pb.DeleteReservationRequest) (*emptypb.Empty, error) {
+ return s.doEmptyResponse(ctx, req)
+}
+
func (s *mockLiteServer) ListTopics(ctx context.Context, req *pb.ListTopicsRequest) (*pb.ListTopicsResponse, error) {
retResponse, retErr := s.popGlobalVerifiers(req)
if retErr != nil {
@@ -405,6 +433,30 @@ func (s *mockLiteServer) ListSubscriptions(ctx context.Context, req *pb.ListSubs
return resp, nil
}
+func (s *mockLiteServer) ListReservations(ctx context.Context, req *pb.ListReservationsRequest) (*pb.ListReservationsResponse, error) {
+ retResponse, retErr := s.popGlobalVerifiers(req)
+ if retErr != nil {
+ return nil, retErr
+ }
+ resp, ok := retResponse.(*pb.ListReservationsResponse)
+ if !ok {
+ return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse)
+ }
+ return resp, nil
+}
+
+func (s *mockLiteServer) ListReservationTopics(ctx context.Context, req *pb.ListReservationTopicsRequest) (*pb.ListReservationTopicsResponse, error) {
+ retResponse, retErr := s.popGlobalVerifiers(req)
+ if retErr != nil {
+ return nil, retErr
+ }
+ resp, ok := retResponse.(*pb.ListReservationTopicsResponse)
+ if !ok {
+ return nil, status.Errorf(codes.FailedPrecondition, "mockserver: invalid response type %T", retResponse)
+ }
+ return resp, nil
+}
+
func (s *mockLiteServer) GetOperation(ctx context.Context, req *lrpb.GetOperationRequest) (*lrpb.Operation, error) {
return s.doOperationResponse(ctx, req)
}
