(t *testing.T)
| 116 | } |
| 117 | |
| 118 | func TestWriteBatch_SyncCommit(t *testing.T) { |
| 119 | tempDir := t.TempDir() |
| 120 | cfg := &config.Config{ |
| 121 | LevelDB: config.LevelDBConfig{ |
| 122 | CacheSize: 64 * 1024 * 1024, |
| 123 | BlockSize: 4 * 1024, |
| 124 | WriteBufferSize: 4 * 1024 * 1024, |
| 125 | MaxOpenFiles: 1000, |
| 126 | Compression: true, |
| 127 | }, |
| 128 | } |
| 129 | |
| 130 | db, err := Store{}.Open(tempDir, cfg) |
| 131 | require.NoError(t, err) |
| 132 | defer db.Close() |
| 133 | |
| 134 | wb := db.NewWriteBatch() |
| 135 | defer wb.Close() |
| 136 | |
| 137 | key := []byte("sync-key") |
| 138 | value := []byte("sync-value") |
| 139 | |
| 140 | wb.Put(key, value) |
| 141 | |
| 142 | // Test SyncCommit |
| 143 | err = wb.SyncCommit() |
| 144 | require.NoError(t, err) |
| 145 | |
| 146 | // Verify value |
| 147 | val, err := db.Get(key) |
| 148 | require.NoError(t, err) |
| 149 | assert.Equal(t, value, val) |
| 150 | } |
| 151 | |
| 152 | func TestWriteBatch_Rollback(t *testing.T) { |
| 153 | tempDir := t.TempDir() |
nothing calls this directly
no test coverage detected