@@ -721,6 +721,44 @@ func BenchmarkSQLSerial(b *testing.B) {
721
721
}
722
722
}
723
723
724
+ func TestFutMultipleGetGetTyped (t * testing.T ) {
725
+ conn := test_helpers .ConnectWithValidation (t , server , opts )
726
+ defer conn .Close ()
727
+
728
+ fut := conn .Call17Async ("simple_concat" , []interface {}{"1" })
729
+
730
+ for i := 0 ; i < 30 ; i ++ {
731
+ // [0, 10) fut.Get()
732
+ // [10, 20) fut.GetTyped()
733
+ // [20, 30) Mix
734
+ get := false
735
+ if (i < 10 ) || (i >= 20 && i % 2 == 0 ) {
736
+ get = true
737
+ }
738
+
739
+ if get {
740
+ resp , err := fut .Get ()
741
+ if err != nil {
742
+ t .Errorf ("Failed to call Get(): %s" , err )
743
+ }
744
+ if val , ok := resp .Data [0 ].(string ); ! ok || val != "11" {
745
+ t .Errorf ("Wrong Get() result: %v" , resp .Data )
746
+ }
747
+ } else {
748
+ tpl := struct {
749
+ Val string
750
+ }{}
751
+ err := fut .GetTyped (& tpl )
752
+ if err != nil {
753
+ t .Errorf ("Failed to call GetTyped(): %s" , err )
754
+ }
755
+ if tpl .Val != "11" {
756
+ t .Errorf ("Wrong GetTyped() result: %v" , tpl )
757
+ }
758
+ }
759
+ }
760
+ }
761
+
724
762
///////////////////
725
763
726
764
func TestClient (t * testing.T ) {
@@ -1069,7 +1107,7 @@ func TestClientSessionPush(t *testing.T) {
1069
1107
} else if len (resp .Data ) < 1 {
1070
1108
t .Errorf ("Response.Data is empty after Call17Async" )
1071
1109
} else if val , err := convertUint64 (resp .Data [0 ]); err != nil || val != pushMax {
1072
- t .Errorf ("result is not {{1}} : %v" , resp .Data )
1110
+ t .Errorf ("Result is not %d : %v" , pushMax , resp .Data )
1073
1111
}
1074
1112
1075
1113
// It will will be iterated with a timeout.
@@ -1103,7 +1141,7 @@ func TestClientSessionPush(t *testing.T) {
1103
1141
} else {
1104
1142
respCnt += 1
1105
1143
if val , err := convertUint64 (resp .Data [0 ]); err != nil || val != pushMax {
1106
- t .Errorf ("result is not {{1}} : %v" , resp .Data )
1144
+ t .Errorf ("Result is not %d : %v" , pushMax , resp .Data )
1107
1145
}
1108
1146
}
1109
1147
}
@@ -1120,6 +1158,26 @@ func TestClientSessionPush(t *testing.T) {
1120
1158
t .Errorf ("Expect %d responses but got %d" , 1 , respCnt )
1121
1159
}
1122
1160
}
1161
+
1162
+ // We can collect original responses after iterations.
1163
+ for _ , fut := range []* Future {fut0 , fut1 , fut2 } {
1164
+ resp , err := fut .Get ()
1165
+ if err != nil {
1166
+ t .Errorf ("Unable to call fut.Get(): %s" , err )
1167
+ } else if val , err := convertUint64 (resp .Data [0 ]); err != nil || val != pushMax {
1168
+ t .Errorf ("Result is not %d: %v" , pushMax , resp .Data )
1169
+ }
1170
+
1171
+ tpl := struct {
1172
+ Val int
1173
+ }{}
1174
+ err = fut .GetTyped (& tpl )
1175
+ if err != nil {
1176
+ t .Errorf ("Unable to call fut.GetTyped(): %s" , err )
1177
+ } else if tpl .Val != pushMax {
1178
+ t .Errorf ("Result is not %d: %d" , pushMax , tpl .Val )
1179
+ }
1180
+ }
1123
1181
}
1124
1182
1125
1183
const (
0 commit comments