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:
27
internal/manager/blender_test.go
Normal file
27
internal/manager/blender_test.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestGetLatestBlenderForMajorMinor_UsesCachedVersions(t *testing.T) {
|
||||
blenderVersionCache.mu.Lock()
|
||||
blenderVersionCache.versions = []BlenderVersion{
|
||||
{Major: 4, Minor: 2, Patch: 1, Full: "4.2.1"},
|
||||
{Major: 4, Minor: 2, Patch: 3, Full: "4.2.3"},
|
||||
{Major: 4, Minor: 1, Patch: 9, Full: "4.1.9"},
|
||||
}
|
||||
blenderVersionCache.fetchedAt = time.Now()
|
||||
blenderVersionCache.mu.Unlock()
|
||||
|
||||
m := &Manager{}
|
||||
v, err := m.GetLatestBlenderForMajorMinor(4, 2)
|
||||
if err != nil {
|
||||
t.Fatalf("GetLatestBlenderForMajorMinor failed: %v", err)
|
||||
}
|
||||
if v.Full != "4.2.3" {
|
||||
t.Fatalf("expected highest patch, got %+v", *v)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user