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