Documentation
¶
Overview ¶
Package testutil provides common testing utilities for Sietch
Index ¶
- func AssertDirExists(t *testing.T, path string)
- func AssertFileContains(t *testing.T, path, expectedContent string)
- func AssertFileExists(t *testing.T, path string)
- func AssertFileNotExists(t *testing.T, path string)
- func AssertFileSize(t *testing.T, path string, expectedSize int64)
- func CaptureOutput(t *testing.T, fn func()) (stdout, stderr string)
- func CompareBytes(t *testing.T, expected, actual []byte, context string)
- func CreateTestFile(t *testing.T, dir, filename, content string) string
- func CreateTestFileWithSize(t *testing.T, dir, filename string, size int64) string
- func CreateTestRSAKeyPair(t *testing.T, bits int) (*rsa.PrivateKey, *rsa.PublicKey)
- func CreateTestVaultConfig(t *testing.T, vaultName string) *config.VaultConfig
- func CreateTestVaultStructure(t *testing.T, vaultPath string)
- func GenerateTestData(size int) []byte
- func SkipIfShort(t *testing.T, reason string)
- func TempDir(t testing.TB, prefix string) string
- type MockConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDirExists ¶
AssertDirExists checks if a directory exists and fails the test if it doesn't
func AssertFileContains ¶
AssertFileContains checks if a file contains specific content
func AssertFileExists ¶
AssertFileExists checks if a file exists and fails the test if it doesn't
func AssertFileNotExists ¶
AssertFileNotExists checks if a file doesn't exist and fails the test if it does
func AssertFileSize ¶
AssertFileSize checks if a file has the expected size
func CaptureOutput ¶
CaptureOutput captures stdout/stderr for testing CLI commands
func CompareBytes ¶
CompareBytes compares two byte slices and reports differences
func CreateTestFile ¶
CreateTestFile creates a test file with specified content
func CreateTestFileWithSize ¶
CreateTestFileWithSize creates a test file with random content of specified size
func CreateTestRSAKeyPair ¶
CreateTestRSAKeyPair creates an RSA key pair for testing
func CreateTestVaultConfig ¶
func CreateTestVaultConfig(t *testing.T, vaultName string) *config.VaultConfig
CreateTestVaultConfig creates a basic vault configuration for testing
func CreateTestVaultStructure ¶
CreateTestVaultStructure creates a basic vault directory structure for testing
func GenerateTestData ¶
GenerateTestData generates test data of specified size for benchmarking
func SkipIfShort ¶
SkipIfShort skips the test if running in short mode
Types ¶
type MockConfig ¶
type MockConfig struct {
VaultPath string
Config *config.VaultConfig
}
MockConfig creates a mock configuration for testing
func NewMockConfig ¶
func NewMockConfig(t *testing.T, vaultName string) *MockConfig
NewMockConfig creates a new mock configuration
func (*MockConfig) SetupTestVault ¶
func (mc *MockConfig) SetupTestVault(t *testing.T)
SetupTestVault creates a complete test vault with structure and config