(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestVFSFile_WriteEnabled(t *testing.T) { |
| 227 | client := newWriteTestReplicaClient() |
| 228 | |
| 229 | // Create initial LTX file with page 1 |
| 230 | pageSize := uint32(4096) |
| 231 | initialPage := make([]byte, pageSize) |
| 232 | copy(initialPage, "initial data") |
| 233 | createTestLTXFile(t, client, 1, pageSize, 1, map[uint32][]byte{1: initialPage}) |
| 234 | |
| 235 | // Create VFSFile directly with write enabled |
| 236 | tmpDir := t.TempDir() |
| 237 | bufferPath := tmpDir + "/write-buffer" |
| 238 | |
| 239 | logger := slog.Default() |
| 240 | f := NewVFSFile(client, "test.db", logger) |
| 241 | f.writeEnabled = true |
| 242 | f.dirty = make(map[uint32]int64) |
| 243 | f.syncInterval = 0 |
| 244 | f.bufferPath = bufferPath |
| 245 | |
| 246 | if err := f.Open(); err != nil { |
| 247 | t.Fatal(err) |
| 248 | } |
| 249 | defer f.Close() |
| 250 | |
| 251 | if !f.writeEnabled { |
| 252 | t.Error("expected writeEnabled to be true") |
| 253 | } |
| 254 | |
| 255 | if f.dirty == nil { |
| 256 | t.Error("expected dirty map to be initialized") |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | func TestVFSFile_WriteAt(t *testing.T) { |
| 261 | client := newWriteTestReplicaClient() |
nothing calls this directly
no test coverage detected