Tests the conversion of the child pickers error to the pick result attribute.
(t *testing.T)
| 1012 | |
| 1013 | // Tests the conversion of the child pickers error to the pick result attribute. |
| 1014 | func (s) TestChildPickResultError(t *testing.T) { |
| 1015 | tests := []struct { |
| 1016 | name string |
| 1017 | err error |
| 1018 | want string |
| 1019 | }{ |
| 1020 | { |
| 1021 | name: "nil", |
| 1022 | err: nil, |
| 1023 | want: "complete", |
| 1024 | }, |
| 1025 | { |
| 1026 | name: "errNoSubConnAvailable", |
| 1027 | err: balancer.ErrNoSubConnAvailable, |
| 1028 | want: "queue", |
| 1029 | }, |
| 1030 | { |
| 1031 | name: "status error", |
| 1032 | err: status.Error(codes.Unimplemented, "unimplemented"), |
| 1033 | want: "drop", |
| 1034 | }, |
| 1035 | { |
| 1036 | name: "other error", |
| 1037 | err: errors.New("some error"), |
| 1038 | want: "fail", |
| 1039 | }, |
| 1040 | } |
| 1041 | |
| 1042 | for _, test := range tests { |
| 1043 | t.Run(test.name, func(t *testing.T) { |
| 1044 | if got := errToPickResult(test.err); got != test.want { |
| 1045 | t.Fatalf("errToPickResult(%q) = %v, want %v", test.err, got, test.want) |
| 1046 | } |
| 1047 | }) |
| 1048 | } |
| 1049 | } |
nothing calls this directly
no test coverage detected