Add tests for main package, manager, and various components

- Introduced unit tests for the main package to ensure compilation.
- Added tests for the manager, including validation of upload sessions and handling of Blender binary paths.
- Implemented tests for job token generation and validation, ensuring security and integrity.
- Created tests for configuration management and database schema to verify functionality.
- Added tests for logger and runner components to enhance overall test coverage and reliability.
This commit is contained in:
2026-03-14 22:20:03 -05:00
parent 16d6a95058
commit a3defe5cf6
45 changed files with 1717 additions and 52 deletions

View File

@@ -99,3 +99,27 @@ func TestExtractTar_PathTraversal(t *testing.T) {
t.Fatal("expected error for path traversal, got nil")
}
}
func TestExtractTarFile(t *testing.T) {
destDir := t.TempDir()
tarPath := filepath.Join(t.TempDir(), "archive.tar")
buf := createTarBuffer(map[string]string{
"hello.txt": "world",
})
if err := os.WriteFile(tarPath, buf.Bytes(), 0644); err != nil {
t.Fatalf("write tar file: %v", err)
}
if err := ExtractTarFile(tarPath, destDir); err != nil {
t.Fatalf("ExtractTarFile: %v", err)
}
got, err := os.ReadFile(filepath.Join(destDir, "hello.txt"))
if err != nil {
t.Fatalf("read extracted file: %v", err)
}
if string(got) != "world" {
t.Fatalf("unexpected file content: %q", got)
}
}