diff --git a/protoutils/messages.go b/protoutils/messages.go index e7544a69ac9..17089355813 100644 --- a/protoutils/messages.go +++ b/protoutils/messages.go @@ -23,12 +23,10 @@ import ( // ResourceNameToProto converts a resource.Name to its proto counterpart. func ResourceNameToProto(name resource.Name) *commonpb.ResourceName { return &commonpb.ResourceName{ - Namespace: string(name.API.Type.Namespace), - Type: name.API.Type.Name, - Subtype: name.API.SubtypeName, - Name: name.ShortName(), - RemotePath: name.RemoteNameToRemoteArray(), - LocalName: name.Name, + Namespace: string(name.API.Type.Namespace), + Type: name.API.Type.Name, + Subtype: name.API.SubtypeName, + Name: name.ShortName(), } } diff --git a/protoutils/messages_test.go b/protoutils/messages_test.go index 4466cc39435..f0e628fae40 100644 --- a/protoutils/messages_test.go +++ b/protoutils/messages_test.go @@ -7,8 +7,6 @@ import ( "go.viam.com/test" "google.golang.org/protobuf/types/known/wrapperspb" - - "go.viam.com/rdk/resource" ) func TestStringToAnyPB(t *testing.T) { @@ -42,18 +40,3 @@ func TestStringToAnyPB(t *testing.T) { wrappedVal4 := wrapperspb.String("abcd") test.That(t, anyVal.MessageIs(wrappedVal4), test.ShouldBeTrue) } - -func TestResourceNameToProto(t *testing.T) { - resourceName := resource.Name{ - Name: "totallyLegitResource", - Remote: "remote1:remote2:remote3", - API: resource.NewAPI("space", "fake", "fakeFake"), - } - resourceNameProto := ResourceNameToProto(resourceName) - finalResource := ResourceNameFromProto(resourceNameProto) - - test.That(t, resourceNameProto.LocalName, test.ShouldEqual, "totallyLegitResource") - test.That(t, resourceNameProto.RemotePath, test.ShouldResemble, []string{"remote1", "remote2", "remote3"}) - test.That(t, resourceNameProto.Name, test.ShouldEqual, "remote1:remote2:remote3:totallyLegitResource") - test.That(t, finalResource, test.ShouldResemble, resourceName) -} diff --git a/resource/name.go b/resource/name.go index 1f34578e217..42e06a4730a 100644 --- a/resource/name.go +++ b/resource/name.go @@ -141,14 +141,6 @@ func (n Name) String() string { return name } -// RemoteNameToRemoteArray returns an ordered array of all of remotes in a resource name. -func (n Name) RemoteNameToRemoteArray() []string { - if n.Remote == "" { - return []string{} - } - return strings.Split(n.Remote, ":") -} - // SDPTrackName returns a valid SDP video/audio track name as defined in RFC 4566 (https://www.rfc-editor.org/rfc/rfc4566) // where track names should not include colons. func (n Name) SDPTrackName() string { diff --git a/resource/name_test.go b/resource/name_test.go index 779b8e5e8c1..c6489b7aabe 100644 --- a/resource/name_test.go +++ b/resource/name_test.go @@ -191,21 +191,3 @@ func TestNamesToStrings(t *testing.T) { test.That(t, NamesToStrings(tc.input), test.ShouldResemble, tc.output) } } - -func TestRemoteNameToRemoteArray(t *testing.T) { - t.Run("name with multiple remote returns array of remotes", func(t *testing.T) { - nameTest := Name{ - Remote: "foo:bar:wow", - } - remoteArray := nameTest.RemoteNameToRemoteArray() - test.That(t, remoteArray, test.ShouldResemble, []string{"foo", "bar", "wow"}) - }) - - t.Run("name with empty remotes should return empty string array", func(t *testing.T) { - nameTest := Name{ - Remote: "", - } - remoteArray := nameTest.RemoteNameToRemoteArray() - test.That(t, remoteArray, test.ShouldResemble, []string{}) - }) -} diff --git a/robot/server/server_test.go b/robot/server/server_test.go index 130b1f03111..3270ac69edd 100644 --- a/robot/server/server_test.go +++ b/robot/server/server_test.go @@ -51,12 +51,10 @@ var serverNewResource = arm.Named("") var serverOneResourceResponse = []*commonpb.ResourceName{ { - Namespace: string(serverNewResource.API.Type.Namespace), - Type: serverNewResource.API.Type.Name, - Subtype: serverNewResource.API.SubtypeName, - Name: serverNewResource.Name, - RemotePath: []string{}, - LocalName: "", + Namespace: string(serverNewResource.API.Type.Namespace), + Type: serverNewResource.API.Type.Name, + Subtype: serverNewResource.API.SubtypeName, + Name: serverNewResource.Name, }, } @@ -327,21 +325,17 @@ func TestServer(t *testing.T) { expectedResp := []*pb.ResourceRPCSubtype{ { Subtype: &commonpb.ResourceName{ - Namespace: string(serverNewResource.API.Type.Namespace), - Type: serverNewResource.API.Type.Name, - Subtype: serverNewResource.API.SubtypeName, - RemotePath: []string{}, - Name: "", + Namespace: string(serverNewResource.API.Type.Namespace), + Type: serverNewResource.API.Type.Name, + Subtype: serverNewResource.API.SubtypeName, }, ProtoService: desc1.GetFullyQualifiedName(), }, { Subtype: &commonpb.ResourceName{ - Namespace: string(otherAPI.Type.Namespace), - Type: otherAPI.Type.Name, - Subtype: otherAPI.SubtypeName, - RemotePath: []string{}, - Name: "", + Namespace: string(otherAPI.Type.Namespace), + Type: otherAPI.Type.Name, + Subtype: otherAPI.SubtypeName, }, ProtoService: desc2.GetFullyQualifiedName(), },