(t *testing.T)
| 1346 | } |
| 1347 | |
| 1348 | func TestTx_GetSet(t *testing.T) { |
| 1349 | bucket := "bucket" |
| 1350 | val := []byte("value") |
| 1351 | newVal := []byte("new_value") |
| 1352 | |
| 1353 | t.Run("match value", func(t *testing.T) { |
| 1354 | runNutsDBTest(t, nil, func(t *testing.T, db *DB) { |
| 1355 | txCreateBucket(t, db, DataStructureBTree, bucket, nil) |
| 1356 | txPut(t, db, bucket, testutils.GetTestBytes(1), val, Persistent, nil, nil) |
| 1357 | txGetSet(t, db, bucket, testutils.GetTestBytes(1), newVal, val, nil) |
| 1358 | txGet(t, db, bucket, testutils.GetTestBytes(1), newVal, nil) |
| 1359 | }) |
| 1360 | }) |
| 1361 | |
| 1362 | t.Run("bucket not exist", func(t *testing.T) { |
| 1363 | runNutsDBTest(t, nil, func(t *testing.T, db *DB) { |
| 1364 | txGetSet(t, db, bucket, testutils.GetTestBytes(1), newVal, nil, ErrBucketNotExist) |
| 1365 | }) |
| 1366 | }) |
| 1367 | |
| 1368 | t.Run("expired test", func(t *testing.T) { |
| 1369 | runNutsDBTestWithMockClock(t, nil, func(t *testing.T, db *DB, mc ttl.Clock) { |
| 1370 | txCreateBucket(t, db, DataStructureBTree, bucket, nil) |
| 1371 | txPut(t, db, bucket, testutils.GetTestBytes(1), val, 1, nil, nil) |
| 1372 | mc.AdvanceTime(3 * time.Second) |
| 1373 | txGetSet(t, db, bucket, testutils.GetTestBytes(1), newVal, nil, ErrKeyNotFound) |
| 1374 | }) |
| 1375 | }) |
| 1376 | } |
| 1377 | |
| 1378 | func TestTx_GetTTLAndPersist(t *testing.T) { |
| 1379 | bucket := "bucket1" |
nothing calls this directly
no test coverage detected