@@ -179,7 +179,6 @@ func TestClient(t *testing.T) {
179
179
test .That (t , err , test .ShouldBeNil )
180
180
camera1Client , err := camera .NewClientFromConn (context .Background (), conn , "" , camera .Named (testCameraName ), logger )
181
181
test .That (t , err , test .ShouldBeNil )
182
-
183
182
frame , err := camera .DecodeImageFromCamera (context .Background (), rutils .MimeTypeRawRGBA , nil , camera1Client )
184
183
test .That (t , err , test .ShouldBeNil )
185
184
compVal , _ , err := rimage .CompareImages (img , frame )
@@ -246,10 +245,6 @@ func TestClient(t *testing.T) {
246
245
client2 , err := resourceAPI .RPCClient (context .Background (), conn , "" , camera .Named (failCameraName ), logger )
247
246
test .That (t , err , test .ShouldBeNil )
248
247
249
- _ , _ , err = camera .ReadImage (context .Background (), client2 )
250
- test .That (t , err , test .ShouldNotBeNil )
251
- test .That (t , err .Error (), test .ShouldContainSubstring , errGetImageFailed .Error ())
252
-
253
248
_ , _ , err = client2 .Image (context .Background (), "" , nil )
254
249
test .That (t , err , test .ShouldNotBeNil )
255
250
test .That (t , err .Error (), test .ShouldContainSubstring , errGetImageFailed .Error ())
@@ -572,78 +567,6 @@ func TestClientWithInterceptor(t *testing.T) {
572
567
test .That (t , conn .Close (), test .ShouldBeNil )
573
568
}
574
569
575
- func TestClientStreamAfterClose (t * testing.T ) {
576
- // Set up gRPC server
577
- logger := logging .NewTestLogger (t )
578
- listener , err := net .Listen ("tcp" , "localhost:0" )
579
- test .That (t , err , test .ShouldBeNil )
580
- rpcServer , err := rpc .NewServer (logger , rpc .WithUnauthenticated ())
581
- test .That (t , err , test .ShouldBeNil )
582
-
583
- // Set up camera that can stream images
584
- img := image .NewNRGBA (image .Rect (0 , 0 , 4 , 4 ))
585
- injectCamera := & inject.Camera {}
586
- injectCamera .PropertiesFunc = func (ctx context.Context ) (camera.Properties , error ) {
587
- return camera.Properties {}, nil
588
- }
589
- injectCamera .ImageFunc = func (ctx context.Context , mimeType string , extra map [string ]interface {}) ([]byte , camera.ImageMetadata , error ) {
590
- imgBytes , err := rimage .EncodeImage (ctx , img , mimeType )
591
- test .That (t , err , test .ShouldBeNil )
592
- return imgBytes , camera.ImageMetadata {MimeType : mimeType }, nil
593
- }
594
-
595
- // Register CameraService API in our gRPC server.
596
- resources := map [resource.Name ]camera.Camera {
597
- camera .Named (testCameraName ): injectCamera ,
598
- }
599
- cameraSvc , err := resource .NewAPIResourceCollection (camera .API , resources )
600
- test .That (t , err , test .ShouldBeNil )
601
- resourceAPI , ok , err := resource.LookupAPIRegistration [camera.Camera ](camera .API )
602
- test .That (t , err , test .ShouldBeNil )
603
- test .That (t , ok , test .ShouldBeTrue )
604
- test .That (t , resourceAPI .RegisterRPCService (context .Background (), rpcServer , cameraSvc ), test .ShouldBeNil )
605
-
606
- // Start serving requests.
607
- go rpcServer .Serve (listener )
608
- defer rpcServer .Stop ()
609
-
610
- // Make client connection
611
- conn , err := viamgrpc .Dial (context .Background (), listener .Addr ().String (), logger )
612
- test .That (t , err , test .ShouldBeNil )
613
- client , err := camera .NewClientFromConn (context .Background (), conn , "" , camera .Named (testCameraName ), logger )
614
- test .That (t , err , test .ShouldBeNil )
615
-
616
- // Get a stream
617
- stream , err := client .Stream (context .Background ())
618
- test .That (t , stream , test .ShouldNotBeNil )
619
- test .That (t , err , test .ShouldBeNil )
620
-
621
- // Read from stream
622
- media , _ , err := stream .Next (context .Background ())
623
- test .That (t , media , test .ShouldNotBeNil )
624
- test .That (t , err , test .ShouldBeNil )
625
-
626
- // Close client and read from stream
627
- test .That (t , client .Close (context .Background ()), test .ShouldBeNil )
628
- media , _ , err = stream .Next (context .Background ())
629
- test .That (t , media , test .ShouldBeNil )
630
- test .That (t , err .Error (), test .ShouldContainSubstring , "context canceled" )
631
-
632
- // Get a new stream
633
- stream , err = client .Stream (context .Background ())
634
- test .That (t , stream , test .ShouldNotBeNil )
635
- test .That (t , err , test .ShouldBeNil )
636
-
637
- // Read from the new stream
638
- media , _ , err = stream .Next (context .Background ())
639
- test .That (t , media , test .ShouldNotBeNil )
640
- test .That (t , err , test .ShouldBeNil )
641
-
642
- // Close client and connection
643
- test .That (t , client .Close (context .Background ()), test .ShouldBeNil )
644
- test .That (t , conn .Close (), test .ShouldBeNil )
645
- }
646
-
647
570
// See modmanager_test.go for the happy path (aka, when the
648
571
// client has a webrtc connection).
649
572
func TestRTPPassthroughWithoutWebRTC (t * testing.T ) {
0 commit comments