MCPcopy
hub / github.com/etcd-io/bbolt / TestBasic

Function TestBasic

tests/dmflakey/dmflakey_test.go:28–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

26}
27
28func TestBasic(t *testing.T) {
29 for _, fsType := range []FSType{FSTypeEXT4, FSTypeXFS} {
30 t.Run(string(fsType), func(t *testing.T) {
31 tmpDir := t.TempDir()
32
33 flakey, err := InitFlakey("go-dmflakey", tmpDir, fsType, "")
34 require.NoError(t, err, "init flakey")
35 defer func() {
36 assert.NoError(t, flakey.Teardown())
37 }()
38
39 target := filepath.Join(tmpDir, "root")
40 require.NoError(t, os.MkdirAll(target, 0600))
41
42 require.NoError(t, mount(target, flakey.DevicePath(), ""))
43 defer func() {
44 assert.NoError(t, unmount(target))
45 }()
46
47 file := filepath.Join(target, "test")
48 assert.NoError(t, writeFile(file, []byte("hello, world"), 0600, true))
49
50 assert.NoError(t, unmount(target))
51
52 assert.NoError(t, flakey.Teardown())
53 })
54 }
55}
56
57func TestDropWritesExt4(t *testing.T) {
58 flakey, root := initFlakey(t, FSTypeEXT4)

Callers

nothing calls this directly

Calls 7

InitFlakeyFunction · 0.85
mountFunction · 0.85
unmountFunction · 0.85
writeFileFunction · 0.85
RunMethod · 0.80
TeardownMethod · 0.65
DevicePathMethod · 0.65

Tested by

no test coverage detected