MCPcopy
hub / github.com/containerd/containerd / generateRandomDiffIDs

Function generateRandomDiffIDs

core/unpack/unpacker_test.go:30–42  ·  view source on GitHub ↗
(t testing.TB, num int)

Source from the content-addressed store, hash-verified

28)
29
30func generateRandomDiffIDs(t testing.TB, num int) []digest.Digest {
31 const size = 10
32 diffIDs := make([]digest.Digest, 0, num)
33 for range num {
34 b := make([]byte, size)
35 _, err := rand.Read(b)
36 if err != nil {
37 t.Fatalf("failed to generate random bytes: %v", err)
38 }
39 diffIDs = append(diffIDs, digest.FromBytes(b))
40 }
41 return diffIDs
42}
43
44func BenchmarkUnpackWithChainID(b *testing.B) {
45 // This simulates the old way of repeatedly calculating per-layer chainID

Callers 2

Calls 1

ReadMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…