Skip to content

Commit f969a7f

Browse files
Merge pull request #44 from kevpar/method-full-name
Fix method full name generation
2 parents 1fb3814 + 271238a commit f969a7f

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

services.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,5 @@ func convertCode(err error) codes.Code {
152152
}
153153

154154
func fullPath(service, method string) string {
155-
return "/" + path.Join("/", service, method)
155+
return "/" + path.Join(service, method)
156156
}

services_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package ttrpc
18+
19+
import (
20+
"testing"
21+
)
22+
23+
func Test_MethodFullNameGeneration(t *testing.T) {
24+
name := fullPath("test.v1.service", "Foo")
25+
expectedName := "/test.v1.service/Foo"
26+
if name != expectedName {
27+
t.Fatalf("Service name does not match. Expected: %q, Actual: %q", expectedName, name)
28+
}
29+
}

0 commit comments

Comments
 (0)