@@ -437,34 +437,67 @@ func TestNoDefaultSerdes(t *testing.T) {
437
437
desc string
438
438
hostPorts []string
439
439
opts []client.Option
440
+ expectErr bool
440
441
}{
442
+ {
443
+ desc : "use FastCodec and SkipDecoder, connect to Frugal and SkipDecoder enabled server" ,
444
+ hostPorts : []string {noDefSerdesFrugalAddr },
445
+ opts : []client.Option {
446
+ client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FastWrite | thrift .FastRead | thrift .EnableSkipDecoder )),
447
+ },
448
+ },
449
+ {
450
+ desc : "use Frugal and SkipDecoder, connect to Frugal and SkipDecoder enabled server" ,
451
+ hostPorts : []string {noDefSerdesFrugalAddr },
452
+ opts : []client.Option {
453
+ client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FrugalWrite | thrift .FrugalRead | thrift .EnableSkipDecoder )),
454
+ },
455
+ },
456
+ {
457
+ desc : "use FastCodec and SkipDecoder, connect to FastCodec and SkipDecoder enabled server" ,
458
+ hostPorts : []string {noDefSerdesFastCodecAddr },
459
+ opts : []client.Option {
460
+ client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FastWrite | thrift .FastRead | thrift .EnableSkipDecoder )),
461
+ },
462
+ },
463
+ {
464
+ desc : "use Frugal and SkipDecoder, connect to FastCodec and SkipDecoder enabled server" ,
465
+ hostPorts : []string {noDefSerdesFastCodecAddr },
466
+ opts : []client.Option {
467
+ client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FrugalWrite | thrift .FrugalRead | thrift .EnableSkipDecoder )),
468
+ },
469
+ },
441
470
{
442
471
desc : "use FastCodec, connect to Frugal and SkipDecoder enabled server" ,
443
472
hostPorts : []string {noDefSerdesFrugalAddr },
444
473
opts : []client.Option {
445
474
client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FastWrite | thrift .FastRead )),
446
475
},
476
+ expectErr : true ,
447
477
},
448
478
{
449
479
desc : "use Frugal, connect to Frugal and SkipDecoder enabled server" ,
450
480
hostPorts : []string {noDefSerdesFrugalAddr },
451
481
opts : []client.Option {
452
482
client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FrugalWrite | thrift .FrugalRead )),
453
483
},
484
+ expectErr : true ,
454
485
},
455
486
{
456
487
desc : "use FastCodec, connect to FastCodec and SkipDecoder enabled server" ,
457
488
hostPorts : []string {noDefSerdesFastCodecAddr },
458
489
opts : []client.Option {
459
490
client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FastWrite | thrift .FastRead )),
460
491
},
492
+ expectErr : true ,
461
493
},
462
494
{
463
- desc : "use Frugal, connect to Frugal and SkipDecoder enabled server" ,
495
+ desc : "use Frugal, connect to FastCodec and SkipDecoder enabled server" ,
464
496
hostPorts : []string {noDefSerdesFastCodecAddr },
465
497
opts : []client.Option {
466
498
client .WithPayloadCodec (thrift .NewThriftCodecWithConfig (thrift .FrugalWrite | thrift .FrugalRead )),
467
499
},
500
+ expectErr : true ,
468
501
},
469
502
}
470
503
for _ , tc := range testCases {
@@ -473,8 +506,12 @@ func TestNoDefaultSerdes(t *testing.T) {
473
506
ctx , stReq := thriftrpc .CreateNoDefSerdesSTRequest (context .Background ())
474
507
for i := 0 ; i < 3 ; i ++ {
475
508
stResp , err := cliNoDefSerdes .TestSTReq (ctx , stReq )
476
- test .Assert (t , err == nil , err )
477
- test .Assert (t , stReq .Str == stResp .Str )
509
+ if ! tc .expectErr {
510
+ test .Assert (t , err == nil , err )
511
+ test .Assert (t , stReq .Str == stResp .Str )
512
+ } else {
513
+ test .Assert (t , err != nil )
514
+ }
478
515
}
479
516
})
480
517
}
0 commit comments