MCPcopy
hub / github.com/containerd/containerd / TestRoLoop

Function TestRoLoop

core/mount/losetup_linux_test.go:60–74  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

58}
59
60func TestRoLoop(t *testing.T) {
61 testutil.RequiresRoot(t)
62
63 backingFile := createTempFile(t)
64
65 file, err := SetupLoop(backingFile, LoopParams{Readonly: true, Autoclear: true})
66 require.NoError(t, err)
67 t.Cleanup(func() {
68 file.Close()
69 })
70
71 if _, err := file.Write(randomData); err == nil {
72 t.Fatalf("writing to readonly loop device should fail")
73 }
74}
75
76func TestRwLoop(t *testing.T) {
77 testutil.RequiresRoot(t)

Callers

nothing calls this directly

Calls 5

SetupLoopFunction · 0.85
createTempFileFunction · 0.70
CleanupMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…