- Add SQLite database connection management with proper error handling - Implement schema for files, chunks, blobs, and snapshots tables - Create repository pattern for each database table - Add transaction support with proper rollback handling - Integrate database module with fx dependency injection - Make index path configurable via VAULTIK_INDEX_PATH env var - Add fatal error handling for database integrity issues - Update DESIGN.md to clarify file_chunks vs chunk_files distinction - Remove FinalHash from BlobInfo (blobs are content-addressable) - Add file metadata support (mtime, ctime, mode, uid, gid, symlinks)
51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package cli
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
// TestCLIEntry ensures the CLI can be imported and basic initialization works
|
|
func TestCLIEntry(t *testing.T) {
|
|
// This test primarily serves as a compilation test
|
|
// to ensure all imports resolve correctly
|
|
cmd := NewRootCommand()
|
|
if cmd == nil {
|
|
t.Fatal("NewRootCommand() returned nil")
|
|
}
|
|
|
|
if cmd.Use != "vaultik" {
|
|
t.Errorf("Expected command use to be 'vaultik', got '%s'", cmd.Use)
|
|
}
|
|
|
|
// Verify all subcommands are registered
|
|
expectedCommands := []string{"backup", "restore", "prune", "verify", "fetch"}
|
|
for _, expected := range expectedCommands {
|
|
found := false
|
|
for _, cmd := range cmd.Commands() {
|
|
if cmd.Use == expected || cmd.Name() == expected {
|
|
found = true
|
|
break
|
|
}
|
|
}
|
|
if !found {
|
|
t.Errorf("Expected command '%s' not found", expected)
|
|
}
|
|
}
|
|
|
|
// Verify backup command has proper flags
|
|
backupCmd, _, err := cmd.Find([]string{"backup"})
|
|
if err != nil {
|
|
t.Errorf("Failed to find backup command: %v", err)
|
|
} else {
|
|
if backupCmd.Flag("config") == nil {
|
|
t.Error("Backup command missing --config flag")
|
|
}
|
|
if backupCmd.Flag("daemon") == nil {
|
|
t.Error("Backup command missing --daemon flag")
|
|
}
|
|
if backupCmd.Flag("cron") == nil {
|
|
t.Error("Backup command missing --cron flag")
|
|
}
|
|
}
|
|
}
|