diff --git a/components/button/client_test.go b/components/button/client_test.go index bad74ba562e..10e38ef53df 100644 --- a/components/button/client_test.go +++ b/components/button/client_test.go @@ -16,6 +16,13 @@ import ( "go.viam.com/rdk/testutils/inject" ) +const ( + testButtonName = "button1" + testButtonName2 = "button2" + failButtonName = "button3" + missingButtonName = "button4" +) + func TestClient(t *testing.T) { logger := logging.NewTestLogger(t) listener1, err := net.Listen("tcp", "localhost:0") diff --git a/components/button/button_test.go b/components/button/fake/button_test.go similarity index 77% rename from components/button/button_test.go rename to components/button/fake/button_test.go index c891739b7ea..2a2d40c37f5 100644 --- a/components/button/button_test.go +++ b/components/button/fake/button_test.go @@ -1,4 +1,4 @@ -package button_test +package fake_test import ( "context" @@ -12,13 +12,6 @@ import ( "go.viam.com/rdk/resource" ) -const ( - testButtonName = "button1" - testButtonName2 = "button2" - failButtonName = "button3" - missingButtonName = "button4" -) - func TestPush(t *testing.T) { logger := logging.NewTestLogger(t) cfg := resource.Config{ diff --git a/components/button/server.go b/components/button/server.go index 89ab4c92092..c5d18df637f 100644 --- a/components/button/server.go +++ b/components/button/server.go @@ -36,9 +36,9 @@ func (s *serviceServer) Push(ctx context.Context, req *pb.PushRequest) (*pb.Push func (s *serviceServer) DoCommand(ctx context.Context, req *commonpb.DoCommandRequest, ) (*commonpb.DoCommandResponse, error) { - gripper, err := s.coll.Resource(req.GetName()) + button, err := s.coll.Resource(req.GetName()) if err != nil { return nil, err } - return protoutils.DoFromResourceServer(ctx, gripper, req) + return protoutils.DoFromResourceServer(ctx, button, req) } diff --git a/components/button/server_test.go b/components/button/server_test.go index 6a8ea591e75..eb44de8b7b1 100644 --- a/components/button/server_test.go +++ b/components/button/server_test.go @@ -67,7 +67,7 @@ func TestServer(t *testing.T) { _, err = buttonServer.Push(context.Background(), &pb.PushRequest{Name: testButtonName2}) test.That(t, err, test.ShouldNotBeNil) - test.That(t, err.Error(), test.ShouldContainSubstring, errCantPush.Error()) + test.That(t, err, test.ShouldBeError, errCantPush) test.That(t, buttonPushed, test.ShouldEqual, testButtonName2) })