Merge pull request #116083 from SataQiu/clean-20230227

kubelet: remove unused DockerID type
This commit is contained in:
Kubernetes Prow Robot 2023-03-06 02:22:58 -08:00 committed by GitHub
commit b8aaaf380a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 14 deletions

View File

@ -254,17 +254,6 @@ func (c *ContainerID) UnmarshalJSON(data []byte) error {
return c.ParseString(string(data))
}
// DockerID is an ID of docker container. It is a type to make it clear when we're working with docker container Ids
type DockerID string
// ContainerID converts DockerID into a ContainerID.
func (id DockerID) ContainerID() ContainerID {
return ContainerID{
Type: "docker",
ID: string(id),
}
}
// State represents the state of a container
type State string

View File

@ -40,10 +40,10 @@ func TestLogSymLink(t *testing.T) {
containerLogsDir := "/foo/bar"
podFullName := randStringBytes(128)
containerName := randStringBytes(70)
dockerID := randStringBytes(80)
containerID := randStringBytes(80)
// The file name cannot exceed 255 characters. Since .log suffix is required, the prefix cannot exceed 251 characters.
expectedPath := filepath.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, dockerID)[:251]+".log")
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, dockerID))
expectedPath := filepath.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, containerID)[:251]+".log")
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, containerID))
}
func TestLegacyLogSymLink(t *testing.T) {