@@ -481,6 +481,90 @@ func TestConvertFromProtobufCheckHealthRequest(t *testing.T) {
481
481
})
482
482
}
483
483
484
+ func TestConvertFromProtobufSubscribeStreamRequest (t * testing.T ) {
485
+ t .Run ("Should convert provided headers" , func (t * testing.T ) {
486
+ protoReq := & pluginv2.SubscribeStreamRequest {
487
+ PluginContext : protoPluginContext ,
488
+ Headers : map [string ]string {
489
+ "foo" : "fooVal" ,
490
+ "bar" : "barVal" ,
491
+ },
492
+ }
493
+
494
+ req := FromProto ().SubscribeStreamRequest (protoReq )
495
+ require .NotNil (t , req )
496
+ require .NotNil (t , req .PluginContext )
497
+ require .Equal (t , protoPluginContext .OrgId , req .PluginContext .OrgID )
498
+ require .Equal (t , protoReq .Headers , req .Headers )
499
+ })
500
+
501
+ t .Run ("Should handle nil-provided headers" , func (t * testing.T ) {
502
+ protoReq := & pluginv2.SubscribeStreamRequest {
503
+ PluginContext : protoPluginContext ,
504
+ }
505
+
506
+ req := FromProto ().SubscribeStreamRequest (protoReq )
507
+ require .NotNil (t , req )
508
+ require .Equal (t , map [string ]string {}, req .Headers )
509
+ })
510
+ }
511
+
512
+ func TestConvertFromProtobufPublishStreamRequest (t * testing.T ) {
513
+ t .Run ("Should convert provided headers" , func (t * testing.T ) {
514
+ protoReq := & pluginv2.PublishStreamRequest {
515
+ PluginContext : protoPluginContext ,
516
+ Headers : map [string ]string {
517
+ "foo" : "fooVal" ,
518
+ "bar" : "barVal" ,
519
+ },
520
+ }
521
+
522
+ req := FromProto ().PublishStreamRequest (protoReq )
523
+ require .NotNil (t , req )
524
+ require .NotNil (t , req .PluginContext )
525
+ require .Equal (t , protoPluginContext .OrgId , req .PluginContext .OrgID )
526
+ require .Equal (t , protoReq .Headers , req .Headers )
527
+ })
528
+
529
+ t .Run ("Should handle nil-provided headers" , func (t * testing.T ) {
530
+ protoReq := & pluginv2.PublishStreamRequest {
531
+ PluginContext : protoPluginContext ,
532
+ }
533
+
534
+ req := FromProto ().PublishStreamRequest (protoReq )
535
+ require .NotNil (t , req )
536
+ require .Equal (t , map [string ]string {}, req .Headers )
537
+ })
538
+ }
539
+
540
+ func TestConvertFromProtobufRunStreamRequest (t * testing.T ) {
541
+ t .Run ("Should convert provided headers" , func (t * testing.T ) {
542
+ protoReq := & pluginv2.RunStreamRequest {
543
+ PluginContext : protoPluginContext ,
544
+ Headers : map [string ]string {
545
+ "foo" : "fooVal" ,
546
+ "bar" : "barVal" ,
547
+ },
548
+ }
549
+
550
+ req := FromProto ().RunStreamRequest (protoReq )
551
+ require .NotNil (t , req )
552
+ require .NotNil (t , req .PluginContext )
553
+ require .Equal (t , protoPluginContext .OrgId , req .PluginContext .OrgID )
554
+ require .Equal (t , protoReq .Headers , req .Headers )
555
+ })
556
+
557
+ t .Run ("Should handle nil-provided headers" , func (t * testing.T ) {
558
+ protoReq := & pluginv2.RunStreamRequest {
559
+ PluginContext : protoPluginContext ,
560
+ }
561
+
562
+ req := FromProto ().RunStreamRequest (protoReq )
563
+ require .NotNil (t , req )
564
+ require .Equal (t , map [string ]string {}, req .Headers )
565
+ })
566
+ }
567
+
484
568
func TestConvertFromProtobufDataResponse (t * testing.T ) {
485
569
t .Run ("Should convert data query response" , func (t * testing.T ) {
486
570
tcs := []struct {
0 commit comments