mirror of
https://github.com/linka-cloud/grpc.git
synced 2026-01-25 11:05:05 +00:00
feat(server/client): add windows pipe, pipe peer credentials support
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
This commit is contained in:
26
client/client_test.go
Normal file
26
client/client_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseDialTarget(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expectedNet string
|
||||
expectedAddr string
|
||||
}{
|
||||
{"tcp://localhost:50051", "tcp", "localhost:50051"},
|
||||
{"localhost:50051", "tcp", "localhost:50051"},
|
||||
{"unix:///tmp/socket", "unix", "/tmp/socket"},
|
||||
{"unix://C:/path/to/socket", "unix", "C:/path/to/socket"},
|
||||
{"unix:path/to/socket", "unix", "path/to/socket"},
|
||||
{`\\.\pipe\example`, "pipe", `\\.\pipe\example`},
|
||||
}
|
||||
for _, test := range tests {
|
||||
net, addr := parseDialTarget(test.input)
|
||||
if net != test.expectedNet || addr != test.expectedAddr {
|
||||
t.Errorf("parseDialTarget(%q) = (%q, %q); want (%q, %q)", test.input, net, addr, test.expectedNet, test.expectedAddr)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user