mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Fix operations tests
This commit is contained in:
@@ -110,7 +110,7 @@ func (im *instanceManager) Shutdown() {
|
|||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
fmt.Printf("Stopping instance %s...\n", inst.Name)
|
fmt.Printf("Stopping instance %s...\n", inst.Name)
|
||||||
if err := inst.Stop(); err != nil {
|
if err := inst.Stop(); err != nil {
|
||||||
fmt.Printf("Error stopping instance %s: %w\n", inst.Name, err)
|
log.Printf("Error stopping instance %s: %v\n", inst.Name, err)
|
||||||
}
|
}
|
||||||
}(inst)
|
}(inst)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ func TestConcurrentAccess(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Concurrent list operations
|
// Concurrent list operations
|
||||||
for i := 0; i < 3; i++ {
|
for range 3 {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|||||||
@@ -155,15 +155,13 @@ func TestDeleteInstance_RunningInstanceFails(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := mgr.CreateInstance("test-instance", options)
|
inst, err := mgr.CreateInstance("test-instance", options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("CreateInstance failed: %v", err)
|
t.Fatalf("CreateInstance failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = mgr.StartInstance("test-instance")
|
// Simulate starting the instance
|
||||||
if err != nil {
|
inst.SetStatus(instance.Running)
|
||||||
t.Fatalf("StartInstance failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Should fail to delete running instance
|
// Should fail to delete running instance
|
||||||
err = mgr.DeleteInstance("test-instance")
|
err = mgr.DeleteInstance("test-instance")
|
||||||
@@ -186,15 +184,13 @@ func TestUpdateInstance(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := mgr.CreateInstance("test-instance", options)
|
inst, err := mgr.CreateInstance("test-instance", options)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("CreateInstance failed: %v", err)
|
t.Fatalf("CreateInstance failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = mgr.StartInstance("test-instance")
|
// Simulate starting the instance
|
||||||
if err != nil {
|
inst.SetStatus(instance.Running)
|
||||||
t.Fatalf("StartInstance failed: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update running instance with new model
|
// Update running instance with new model
|
||||||
newOptions := &instance.Options{
|
newOptions := &instance.Options{
|
||||||
@@ -212,9 +208,10 @@ func TestUpdateInstance(t *testing.T) {
|
|||||||
t.Fatalf("UpdateInstance failed: %v", err)
|
t.Fatalf("UpdateInstance failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should still be running after update
|
// Should be either running or restarting after update
|
||||||
if !updated.IsRunning() {
|
status := updated.GetStatus()
|
||||||
t.Error("Instance should be running after update")
|
if status != instance.Running && status != instance.Restarting {
|
||||||
|
t.Error("Instance should be running or restarting after update")
|
||||||
}
|
}
|
||||||
|
|
||||||
if updated.GetOptions().BackendOptions.LlamaServerOptions.Model != "/path/to/new-model.gguf" {
|
if updated.GetOptions().BackendOptions.LlamaServerOptions.Model != "/path/to/new-model.gguf" {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"log"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5"
|
"github.com/go-chi/chi/v5"
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
@@ -159,7 +159,7 @@ func SetupRouter(handler *Handler) *chi.Mux {
|
|||||||
|
|
||||||
// Serve WebUI files
|
// Serve WebUI files
|
||||||
if err := webui.SetupWebUI(r); err != nil {
|
if err := webui.SetupWebUI(r); err != nil {
|
||||||
fmt.Printf("Failed to set up WebUI: %w\n", err)
|
log.Printf("Failed to set up WebUI: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|||||||
Reference in New Issue
Block a user