@@ -621,3 +621,279 @@ func TestRequestsSetters(t *testing.T) {
621
621
})
622
622
}
623
623
}
624
+
625
+ func TestRequestsVshardRouter (t * testing.T ) {
626
+ testCases := []struct {
627
+ name string
628
+ ref tarantool.Request
629
+ target tarantool.Request
630
+ }{
631
+ {
632
+ name : "InsertRequest" ,
633
+ ref : tarantool .NewCall17Request ("crud.insert" ).Args ([]interface {}{
634
+ validSpace ,
635
+ []interface {}{},
636
+ map [string ]interface {}{"vshard_router" : "custom_router" },
637
+ }),
638
+ target : crud .MakeInsertRequest (validSpace ).Opts (crud.InsertOpts {
639
+ VshardRouter : crud .MakeOptString ("custom_router" ),
640
+ }),
641
+ },
642
+ {
643
+ name : "InsertObjectRequest" ,
644
+ ref : tarantool .NewCall17Request ("crud.insert_object" ).Args ([]interface {}{
645
+ validSpace ,
646
+ map [string ]interface {}{},
647
+ map [string ]interface {}{"vshard_router" : "custom_router" },
648
+ }),
649
+ target : crud .MakeInsertObjectRequest (validSpace ).Opts (crud.InsertObjectOpts {
650
+ VshardRouter : crud .MakeOptString ("custom_router" ),
651
+ }),
652
+ },
653
+ {
654
+ name : "InsertManyRequest" ,
655
+ ref : tarantool .NewCall17Request ("crud.insert_many" ).Args ([]interface {}{
656
+ validSpace ,
657
+ []interface {}{},
658
+ map [string ]interface {}{"vshard_router" : "custom_router" },
659
+ }),
660
+ target : crud .MakeInsertManyRequest (validSpace ).Opts (crud.InsertManyOpts {
661
+ VshardRouter : crud .MakeOptString ("custom_router" ),
662
+ }),
663
+ },
664
+ {
665
+ name : "InsertObjectManyRequest" ,
666
+ ref : tarantool .NewCall17Request ("crud.insert_object_many" ).Args ([]interface {}{
667
+ validSpace ,
668
+ []map [string ]interface {}{},
669
+ map [string ]interface {}{"vshard_router" : "custom_router" },
670
+ }),
671
+ target : crud .MakeInsertObjectManyRequest (validSpace ).Opts (crud.InsertObjectManyOpts {
672
+ VshardRouter : crud .MakeOptString ("custom_router" ),
673
+ }),
674
+ },
675
+ {
676
+ name : "GetRequest" ,
677
+ ref : tarantool .NewCall17Request ("crud.get" ).Args ([]interface {}{
678
+ validSpace ,
679
+ []interface {}{},
680
+ map [string ]interface {}{"vshard_router" : "custom_router" },
681
+ }),
682
+ target : crud .MakeGetRequest (validSpace ).Opts (crud.GetOpts {
683
+ VshardRouter : crud .MakeOptString ("custom_router" ),
684
+ }),
685
+ },
686
+ {
687
+ name : "UpdateRequest" ,
688
+ ref : tarantool .NewCall17Request ("crud.update" ).Args ([]interface {}{
689
+ validSpace ,
690
+ []interface {}{},
691
+ []interface {}{},
692
+ map [string ]interface {}{"vshard_router" : "custom_router" },
693
+ }),
694
+ target : crud .MakeUpdateRequest (validSpace ).Opts (crud.UpdateOpts {
695
+ VshardRouter : crud .MakeOptString ("custom_router" ),
696
+ }),
697
+ },
698
+ {
699
+ name : "DeleteRequest" ,
700
+ ref : tarantool .NewCall17Request ("crud.delete" ).Args ([]interface {}{
701
+ validSpace ,
702
+ []interface {}{},
703
+ map [string ]interface {}{"vshard_router" : "custom_router" },
704
+ }),
705
+ target : crud .MakeDeleteRequest (validSpace ).Opts (crud.DeleteOpts {
706
+ VshardRouter : crud .MakeOptString ("custom_router" ),
707
+ }),
708
+ },
709
+ {
710
+ name : "ReplaceRequest" ,
711
+ ref : tarantool .NewCall17Request ("crud.replace" ).Args ([]interface {}{
712
+ validSpace ,
713
+ []interface {}{},
714
+ map [string ]interface {}{"vshard_router" : "custom_router" },
715
+ }),
716
+ target : crud .MakeReplaceRequest (validSpace ).Opts (crud.ReplaceOpts {
717
+ VshardRouter : crud .MakeOptString ("custom_router" ),
718
+ }),
719
+ },
720
+ {
721
+ name : "ReplaceObjectRequest" ,
722
+ ref : tarantool .NewCall17Request ("crud.replace_object" ).Args ([]interface {}{
723
+ validSpace ,
724
+ map [string ]interface {}{},
725
+ map [string ]interface {}{"vshard_router" : "custom_router" },
726
+ }),
727
+ target : crud .MakeReplaceObjectRequest (validSpace ).Opts (crud.ReplaceObjectOpts {
728
+ VshardRouter : crud .MakeOptString ("custom_router" ),
729
+ }),
730
+ },
731
+ {
732
+ name : "ReplaceManyRequest" ,
733
+ ref : tarantool .NewCall17Request ("crud.replace_many" ).Args ([]interface {}{
734
+ validSpace ,
735
+ []interface {}{},
736
+ map [string ]interface {}{"vshard_router" : "custom_router" },
737
+ }),
738
+ target : crud .MakeReplaceManyRequest (validSpace ).Opts (crud.ReplaceManyOpts {
739
+ VshardRouter : crud .MakeOptString ("custom_router" ),
740
+ }),
741
+ },
742
+ {
743
+ name : "ReplaceObjectManyRequest" ,
744
+ ref : tarantool .NewCall17Request ("crud.replace_object_many" ).Args ([]interface {}{
745
+ validSpace ,
746
+ []map [string ]interface {}{},
747
+ map [string ]interface {}{"vshard_router" : "custom_router" },
748
+ }),
749
+ target : crud .MakeReplaceObjectManyRequest (validSpace ).Opts (crud.ReplaceObjectManyOpts {
750
+ VshardRouter : crud .MakeOptString ("custom_router" ),
751
+ }),
752
+ },
753
+ {
754
+ name : "UpsertRequest" ,
755
+ ref : tarantool .NewCall17Request ("crud.upsert" ).Args ([]interface {}{
756
+ validSpace ,
757
+ []interface {}{},
758
+ []interface {}{},
759
+ map [string ]interface {}{"vshard_router" : "custom_router" },
760
+ }),
761
+ target : crud .MakeUpsertRequest (validSpace ).Opts (crud.UpsertOpts {
762
+ VshardRouter : crud .MakeOptString ("custom_router" ),
763
+ }),
764
+ },
765
+ {
766
+ name : "UpsertObjectRequest" ,
767
+ ref : tarantool .NewCall17Request ("crud.upsert_object" ).Args ([]interface {}{
768
+ validSpace ,
769
+ map [string ]interface {}{},
770
+ []interface {}{},
771
+ map [string ]interface {}{"vshard_router" : "custom_router" },
772
+ }),
773
+ target : crud .MakeUpsertObjectRequest (validSpace ).Opts (crud.UpsertObjectOpts {
774
+ VshardRouter : crud .MakeOptString ("custom_router" ),
775
+ }),
776
+ },
777
+ {
778
+ name : "UpsertManyRequest" ,
779
+ ref : tarantool .NewCall17Request ("crud.upsert_many" ).Args ([]interface {}{
780
+ validSpace ,
781
+ []interface {}{},
782
+ map [string ]interface {}{"vshard_router" : "custom_router" },
783
+ }),
784
+ target : crud .MakeUpsertManyRequest (validSpace ).Opts (crud.UpsertManyOpts {
785
+ VshardRouter : crud .MakeOptString ("custom_router" ),
786
+ }),
787
+ },
788
+ {
789
+ name : "UpsertObjectManyRequest" ,
790
+ ref : tarantool .NewCall17Request ("crud.upsert_object_many" ).Args ([]interface {}{
791
+ validSpace ,
792
+ []interface {}{},
793
+ map [string ]interface {}{"vshard_router" : "custom_router" },
794
+ }),
795
+ target : crud .MakeUpsertObjectManyRequest (validSpace ).Opts (crud.UpsertObjectManyOpts {
796
+ VshardRouter : crud .MakeOptString ("custom_router" ),
797
+ }),
798
+ },
799
+ {
800
+ name : "SelectRequest" ,
801
+ ref : tarantool .NewCall17Request ("crud.select" ).Args ([]interface {}{
802
+ validSpace ,
803
+ nil ,
804
+ map [string ]interface {}{"vshard_router" : "custom_router" },
805
+ }),
806
+ target : crud .MakeSelectRequest (validSpace ).Opts (crud.SelectOpts {
807
+ VshardRouter : crud .MakeOptString ("custom_router" ),
808
+ }),
809
+ },
810
+ {
811
+ name : "MinRequest" ,
812
+ ref : tarantool .NewCall17Request ("crud.min" ).Args ([]interface {}{
813
+ validSpace ,
814
+ nil ,
815
+ map [string ]interface {}{"vshard_router" : "custom_router" },
816
+ }),
817
+ target : crud .MakeMinRequest (validSpace ).Opts (crud.MinOpts {
818
+ VshardRouter : crud .MakeOptString ("custom_router" ),
819
+ }),
820
+ },
821
+ {
822
+ name : "MaxRequest" ,
823
+ ref : tarantool .NewCall17Request ("crud.max" ).Args ([]interface {}{
824
+ validSpace ,
825
+ nil ,
826
+ map [string ]interface {}{"vshard_router" : "custom_router" },
827
+ }),
828
+ target : crud .MakeMaxRequest (validSpace ).Opts (crud.MaxOpts {
829
+ VshardRouter : crud .MakeOptString ("custom_router" ),
830
+ }),
831
+ },
832
+ {
833
+ name : "TruncateRequest" ,
834
+ ref : tarantool .NewCall17Request ("crud.truncate" ).Args ([]interface {}{
835
+ validSpace ,
836
+ map [string ]interface {}{"vshard_router" : "custom_router" },
837
+ }),
838
+ target : crud .MakeTruncateRequest (validSpace ).Opts (crud.TruncateOpts {
839
+ VshardRouter : crud .MakeOptString ("custom_router" ),
840
+ }),
841
+ },
842
+ {
843
+ name : "LenRequest" ,
844
+ ref : tarantool .NewCall17Request ("crud.len" ).Args ([]interface {}{
845
+ validSpace ,
846
+ map [string ]interface {}{"vshard_router" : "custom_router" },
847
+ }),
848
+ target : crud .MakeLenRequest (validSpace ).Opts (crud.LenOpts {
849
+ VshardRouter : crud .MakeOptString ("custom_router" ),
850
+ }),
851
+ },
852
+ {
853
+ name : "CountRequest" ,
854
+ ref : tarantool .NewCall17Request ("crud.count" ).Args ([]interface {}{
855
+ validSpace ,
856
+ nil ,
857
+ map [string ]interface {}{"vshard_router" : "custom_router" },
858
+ }),
859
+ target : crud .MakeCountRequest (validSpace ).Opts (crud.CountOpts {
860
+ VshardRouter : crud .MakeOptString ("custom_router" ),
861
+ }),
862
+ },
863
+ {
864
+ name : "StorageInfoRequest" ,
865
+ ref : tarantool .NewCall17Request ("crud.storage_info" ).Args ([]interface {}{
866
+ map [string ]interface {}{"vshard_router" : "custom_router" },
867
+ }),
868
+ target : crud .MakeStorageInfoRequest ().Opts (crud.StorageInfoOpts {
869
+ VshardRouter : crud .MakeOptString ("custom_router" ),
870
+ }),
871
+ },
872
+ {
873
+ name : "SchemaRequest" ,
874
+ ref : tarantool .NewCall17Request ("crud.schema" ).Args ([]interface {}{
875
+ nil ,
876
+ map [string ]interface {}{"vshard_router" : "custom_router" },
877
+ }),
878
+ target : crud .MakeSchemaRequest ().Opts (crud.SchemaOpts {
879
+ VshardRouter : crud .MakeOptString ("custom_router" ),
880
+ }),
881
+ },
882
+ {
883
+ name : "SchemaRequestWithSpace" ,
884
+ ref : tarantool .NewCall17Request ("crud.schema" ).Args ([]interface {}{
885
+ validSpace ,
886
+ map [string ]interface {}{"vshard_router" : "custom_router" },
887
+ }),
888
+ target : crud .MakeSchemaRequest ().Space (validSpace ).Opts (crud.SchemaOpts {
889
+ VshardRouter : crud .MakeOptString ("custom_router" ),
890
+ }),
891
+ },
892
+ }
893
+
894
+ for _ , tc := range testCases {
895
+ t .Run (tc .name , func (t * testing.T ) {
896
+ assertBodyEqual (t , tc .ref , tc .target )
897
+ })
898
+ }
899
+ }
0 commit comments