add-ut-for-legacyLogSymlink
This commit is contained in:
parent
2f4cca73af
commit
dc873efc60
@ -45,3 +45,14 @@ func TestLogSymLink(t *testing.T) {
|
|||||||
expectedPath := path.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, dockerId)[:251]+".log")
|
expectedPath := path.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, dockerId)[:251]+".log")
|
||||||
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, dockerId))
|
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, dockerId))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLegacyLogSymLink(t *testing.T) {
|
||||||
|
as := assert.New(t)
|
||||||
|
containerID := randStringBytes(80)
|
||||||
|
containerName := randStringBytes(70)
|
||||||
|
podName := randStringBytes(128)
|
||||||
|
podNamespace := randStringBytes(10)
|
||||||
|
// The file name cannot exceed 255 characters. Since .log suffix is required, the prefix cannot exceed 251 characters.
|
||||||
|
expectedPath := path.Join(legacyContainerLogsDir, fmt.Sprintf("%s_%s_%s-%s", podName, podNamespace, containerName, containerID)[:251]+".log")
|
||||||
|
as.Equal(expectedPath, legacyLogSymlink(containerID, containerName, podName, podNamespace))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user