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:
Kubernetes Prow Robot 2022-07-07 20:35:57 -07:00 committed by GitHub
commit c05d185901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -180,3 +180,28 @@ func TestGetAddressAndDialer(t *testing.T) {
assert.Equal(t, test.expectedAddr, addr) 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)
}
}