mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #110683 from zhoumingcheng/master-v2
add unit test coverage for pkg/kubelet/util/util_unix_test.go
This commit is contained in:
commit
c05d185901
@ -180,3 +180,28 @@ func TestGetAddressAndDialer(t *testing.T) {
|
||||
assert.Equal(t, test.expectedAddr, addr)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalEndpoint(t *testing.T) {
|
||||
tests := []struct {
|
||||
path string
|
||||
file string
|
||||
expectError bool
|
||||
expectedFullPath string
|
||||
}{
|
||||
{
|
||||
path: "path",
|
||||
file: "file",
|
||||
expectError: false,
|
||||
expectedFullPath: "unix:/path/file.sock",
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
fullPath, err := LocalEndpoint(test.path, test.file)
|
||||
if test.expectError {
|
||||
assert.NotNil(t, err, "expected error")
|
||||
continue
|
||||
}
|
||||
assert.Nil(t, err, "expected no error")
|
||||
assert.Equal(t, test.expectedFullPath, fullPath)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user