From d31b4348951ef3b5cfc0a746880333636a0d1020 Mon Sep 17 00:00:00 2001 From: hexbabe Date: Thu, 14 Nov 2024 16:40:15 -0500 Subject: [PATCH] Use imgbuf bytes directly for a robot client test rather than encode from img; Fix prev test bug --- robot/client/client_test.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/robot/client/client_test.go b/robot/client/client_test.go index 6a54c4b60c4..86f1d4c8e08 100644 --- a/robot/client/client_test.go +++ b/robot/client/client_test.go @@ -332,9 +332,7 @@ func TestStatusClient(t *testing.T) { test.That(t, png.Encode(&imgBuf, img), test.ShouldBeNil) injectCamera.ImageFunc = func(ctx context.Context, mimeType string, extra map[string]interface{}) ([]byte, camera.ImageMetadata, error) { - resBytes, err := rimage.EncodeImage(ctx, img, mimeType) - test.That(t, err, test.ShouldBeNil) - return resBytes, camera.ImageMetadata{MimeType: mimeType}, nil + return imgBuf.Bytes(), camera.ImageMetadata{MimeType: rutils.MimeTypePNG}, nil } injectInputDev := &inject.InputController{} @@ -510,7 +508,7 @@ func TestStatusClient(t *testing.T) { test.That(t, err, test.ShouldNotBeNil) test.That(t, err.Error(), test.ShouldContainSubstring, "not found") test.That(t, imgBytes, test.ShouldBeNil) - test.That(t, metadata, test.ShouldEqual, camera.ImageMetadata{}) + test.That(t, metadata, test.ShouldResemble, camera.ImageMetadata{}) gripper1, err := gripper.FromRobot(client, "gripper1") test.That(t, err, test.ShouldBeNil)