MCPcopy
hub / github.com/google/cadvisor / TestStorageDirDetectionWithNewVersions

Function TestStorageDirDetectionWithNewVersions

container/docker/handler_test.go:52–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestStorageDirDetectionWithNewVersions(t *testing.T) {
53 as := assert.New(t)
54 testDir := t.TempDir()
55 containerID := "abcd"
56 randomizedID := "xyz"
57 randomIDPath := path.Join(testDir, "image/aufs/layerdb/mounts/", containerID)
58 as.Nil(os.MkdirAll(randomIDPath, os.ModePerm))
59 as.Nil(os.WriteFile(path.Join(randomIDPath, "mount-id"), []byte(randomizedID), os.ModePerm))
60 rwLayer, err := getRwLayerID(containerID, testDir, "aufs", []int{1, 10, 0})
61 as.Nil(err)
62 as.Equal(rwLayer, randomizedID)
63 rwLayer, err = getRwLayerID(containerID, testDir, "aufs", []int{1, 10, 0})
64 as.Nil(err)
65 as.Equal(rwLayer, randomizedID)
66
67}
68
69func rawMetadataEnvMatch(dockerEnvWhiteList string, cntConfig container.Config) map[string]string {
70 metadataEnvAllowList := strings.Split(dockerEnvWhiteList, ",")

Callers

nothing calls this directly

Calls 1

getRwLayerIDFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…