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:
34
internal/runner/blender/binary_test.go
Normal file
34
internal/runner/blender/binary_test.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package blender
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestResolveBinaryPath_AbsoluteLikePath(t *testing.T) {
|
||||
got, err := ResolveBinaryPath("./blender")
|
||||
if err != nil {
|
||||
t.Fatalf("ResolveBinaryPath failed: %v", err)
|
||||
}
|
||||
if !filepath.IsAbs(got) {
|
||||
t.Fatalf("expected absolute path, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveBinaryPath_Empty(t *testing.T) {
|
||||
if _, err := ResolveBinaryPath(""); err == nil {
|
||||
t.Fatal("expected error for empty blender binary")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTarballEnv_SetsAndExtendsLDLibraryPath(t *testing.T) {
|
||||
bin := filepath.Join(string(os.PathSeparator), "tmp", "blender", "blender")
|
||||
got := TarballEnv(bin, []string{"A=B", "LD_LIBRARY_PATH=/old"})
|
||||
joined := strings.Join(got, "\n")
|
||||
if !strings.Contains(joined, "LD_LIBRARY_PATH=/tmp/blender/lib:/old") {
|
||||
t.Fatalf("expected LD_LIBRARY_PATH to include blender lib, got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user