Skip to content

test(encryption): extract tempfile helper + mixed-load stress test #128

@polaz

Description

@polaz

Summary

Encryption test infrastructure improvements — extract helper (was #127) + add comprehensive stress test (was #128). Both from review of PR #105.

Part 1: Extract tempfile helper (was #127)

Block from_file tests repeat the same tempfile + write + reopen + handle construction ~10 times in src/table/block/mod.rs test module.

Extract:

fn write_block_to_tempfile(
    data: &[u8],
    block_type: BlockType,
    compression: CompressionType,
    encryption: Option<&dyn EncryptionProvider>,
) -> crate::Result<(std::fs::File, BlockHandle, Header)>

Files: src/table/block/mod.rs (test module, lines ~580-1400)

Part 2: Mixed-load stress test (was #128)

No test exercises encryption under realistic mixed-workload conditions.

Combination matrix:

  • Encryption: None, AES-256-GCM
  • Compression: None, lz4, zstd (level 1, level 3)
  • Operations: point writes, updates, deletes, range tombstones, merge operators, point reads, range scans, MVCC snapshots
  • Concurrency: single-threaded + multi-threaded (4-8 writers, 2-4 readers)
  • Lifecycle events: memtable flush, compaction, tree close + reopen (recovery)

Files: tests/encryption_roundtrip.rs or new tests/encryption_stress.rs

Why merge

#127 is a prerequisite for #128 — the extracted helper makes writing stress test variants trivial. Both improve encryption test coverage, same review context.

References

Time estimate

1.5d

Metadata

Metadata

Assignees

No one assigned

    Labels

    encryptionEncryption subsystem, AES-GCM, key managementtestTests, test infrastructure, test helpers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions