mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
add unit test
Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
This commit is contained in:
parent
02462739ca
commit
b722056698
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user