Skip to main content

txn_test.go

txn_test.go - Overview

This file contains unit tests for the transaction functionality of BadgerDB, covering various scenarios such as simple transactions, read-after-write consistency, asynchronous commits, versioning, write skew detection, and interactions with iterators. It also includes tests for managed transactions.

Detailed Documentation

TestTxnSimple func

func TestTxnSimple(t *testing.T) {
  • Purpose: Tests a simple transaction with basic set and get operations.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnReadAfterWrite func

func TestTxnReadAfterWrite(t *testing.T) {
  • Purpose: Tests that a read operation after a write operation within different transactions returns the correct value.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnCommitAsync func

func TestTxnCommitAsync(t *testing.T) {
  • Purpose: Tests asynchronous commit functionality using CommitWith.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnVersions func

func TestTxnVersions(t *testing.T) {
  • Purpose: Tests transaction versioning and retrieval of specific versions.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnWriteSkew func

func TestTxnWriteSkew(t *testing.T) {
  • Purpose: Tests write skew anomaly detection.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnIterationEdgeCase func

func TestTxnIterationEdgeCase(t *testing.T) {
  • Purpose: Tests iterator behavior in edge cases with multiple versions and deletes.
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnIterationEdgeCase2 func

func TestTxnIterationEdgeCase2(t *testing.T) {
  • Purpose: Tests iterator behavior in edge cases with multiple versions and deletes (variation).
  • Parameters:
    • t: *testing.T - Testing object.

TestTxnIterationEdgeCase3 func

func TestTxnIterationEdgeCase3(t *testing.T) {
  • Purpose: Tests iterator seek behavior in edge cases.
  • Parameters:
    • t: *testing.T - Testing object.

TestIteratorAllVersionsWithDeleted func

func TestIteratorAllVersionsWithDeleted(t *testing.T) {
  • Purpose: Tests iterator with AllVersions option to ensure deleted versions are returned.
  • Parameters:
    • t: *testing.T - Testing object.

TestIteratorAllVersionsWithDeleted2 func

func TestIteratorAllVersionsWithDeleted2(t *testing.T) {
  • Purpose: Tests iterator with AllVersions option and alternating set and delete operations.
  • Parameters:
    • t: *testing.T - Testing object.

TestManagedDB func

func TestManagedDB(t *testing.T) {
  • Purpose: Tests the managed transaction functionality of BadgerDB.
  • Parameters:
    • t: *testing.T - Testing object.

TestArmV7Issue311Fix func

func TestArmV7Issue311Fix(t *testing.T) {
  • Purpose: Regression test for an ARMv7 issue.
  • Parameters:
    • t: *testing.T - Testing object.

TestConflict func

func TestConflict(t *testing.T) {
  • Purpose: Tests conflict resolution for concurrent transactions.
  • Parameters:
    • t: *testing.T - Testing object.