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:
35
internal/logger/logger_test.go
Normal file
35
internal/logger/logger_test.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseLevel(t *testing.T) {
|
||||
if ParseLevel("debug") != LevelDebug {
|
||||
t.Fatal("debug should map to LevelDebug")
|
||||
}
|
||||
if ParseLevel("warning") != LevelWarn {
|
||||
t.Fatal("warning should map to LevelWarn")
|
||||
}
|
||||
if ParseLevel("unknown") != LevelInfo {
|
||||
t.Fatal("unknown should default to LevelInfo")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetAndGetLevel(t *testing.T) {
|
||||
SetLevel(LevelError)
|
||||
if GetLevel() != LevelError {
|
||||
t.Fatalf("GetLevel() = %v, want %v", GetLevel(), LevelError)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewWithFile_CreatesFile(t *testing.T) {
|
||||
logPath := filepath.Join(t.TempDir(), "runner.log")
|
||||
l, err := NewWithFile(logPath)
|
||||
if err != nil {
|
||||
t.Fatalf("NewWithFile failed: %v", err)
|
||||
}
|
||||
defer l.Close()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user