package docker

import (
	"bytes"
	"testing"
)

func TestSelfContainerID(t *testing.T) {
	buf := []byte(`12:memory:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
11:pids:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
10:devices:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
9:cpu,cpuacct:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
8:rdma:/
7:blkio:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
6:perf_event:/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
5:cpuset:/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
4:hugetlb:/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
3:net_cls,net_prio:/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
2:freezer:/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
1:name=systemd:/system.slice/cri.service/kubepods-besteffort-pod6740ca1c_67f8_4908_b89c_e9b9463afd80.slice:cri-containerd:af23dc32d8b34716ff65db62ab4ee677584ddda943cea7213bb112c4c2bfb353
0::/system.slice/cri.service`)

	t.Log(parseContainerID(bytes.NewReader(buf)))
}
