key_registry_test.go
key_registry_test.go - Overview
This file contains unit tests for the key registry functionality related to encryption key management in Badger.
Detailed Documentation
getRegistryTestOptions
Purpose: Constructs KeyRegistryOptions
for testing.
Parameters:
dir
(string): The directory for the key registry.key
([]byte): The encryption key. Returns:KeyRegistryOptions
: Configuration options for the key registry.
TestBuildRegistry
Purpose: Tests the building of a key registry, including opening, creating data keys, and re-opening the registry. Parameters:
t
(*testing.T): Testing object for the test case. Returns: None
TestRewriteRegistry
Purpose: Tests rewriting the key registry after deleting a data key. Parameters:
t
(*testing.T): Testing object for the test case. Returns: None
TestMismatch
Purpose: Tests the behavior of the key registry when opening with a mismatched encryption key. Parameters:
t
(*testing.T): Testing object for the test case. Returns: None
TestEncryptionAndDecryption
Purpose: Tests the encryption and decryption of data keys by opening and closing the key registry. Parameters:
t
(*testing.T): Testing object for the test case. Returns: None
TestKeyRegistryInMemory
Purpose: Tests the key registry functionality when operating in memory. Parameters:
t
(*testing.T): Testing object for the test case. Returns: None