mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #116083 from SataQiu/clean-20230227
kubelet: remove unused DockerID type
This commit is contained in:
commit
b8aaaf380a
@ -254,17 +254,6 @@ func (c *ContainerID) UnmarshalJSON(data []byte) error {
|
|||||||
return c.ParseString(string(data))
|
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
|
// State represents the state of a container
|
||||||
type State string
|
type State string
|
||||||
|
|
||||||
|
@ -40,10 +40,10 @@ func TestLogSymLink(t *testing.T) {
|
|||||||
containerLogsDir := "/foo/bar"
|
containerLogsDir := "/foo/bar"
|
||||||
podFullName := randStringBytes(128)
|
podFullName := randStringBytes(128)
|
||||||
containerName := randStringBytes(70)
|
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.
|
// 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")
|
expectedPath := filepath.Join(containerLogsDir, fmt.Sprintf("%s_%s-%s", podFullName, containerName, containerID)[:251]+".log")
|
||||||
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, dockerID))
|
as.Equal(expectedPath, logSymlink(containerLogsDir, podFullName, containerName, containerID))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestLegacyLogSymLink(t *testing.T) {
|
func TestLegacyLogSymLink(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user