(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func TestErrorWritesExt4(t *testing.T) { |
| 90 | flakey, root := initFlakey(t, FSTypeEXT4) |
| 91 | |
| 92 | // commit=1000 is to delay commit triggered by writeback thread |
| 93 | require.NoError(t, mount(root, flakey.DevicePath(), "commit=1000")) |
| 94 | |
| 95 | // inject IO failure on write |
| 96 | assert.NoError(t, flakey.ErrorWrites()) |
| 97 | |
| 98 | f1 := filepath.Join(root, "f1") |
| 99 | err := writeFile(f1, []byte("hello, world during failpoint"), 0600, true) |
| 100 | assert.ErrorContains(t, err, "input/output error") |
| 101 | |
| 102 | // resume |
| 103 | assert.NoError(t, flakey.AllowWrites()) |
| 104 | err = writeFile(f1, []byte("hello, world"), 0600, true) |
| 105 | assert.NoError(t, err) |
| 106 | |
| 107 | assert.NoError(t, unmount(root)) |
| 108 | require.NoError(t, mount(root, flakey.DevicePath(), "")) |
| 109 | |
| 110 | data, err := os.ReadFile(f1) |
| 111 | assert.NoError(t, err) |
| 112 | assert.Equal(t, "hello, world", string(data)) |
| 113 | } |
| 114 | |
| 115 | func initFlakey(t *testing.T, fsType FSType) (_ Flakey, root string) { |
| 116 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected