Fix instance start simulation in TestUpdateInstance

This commit is contained in:
2025-10-27 19:14:54 +01:00
parent d6a6f377fc
commit 6ec2919049

View File

@@ -191,8 +191,10 @@ func TestUpdateInstance(t *testing.T) {
t.Fatalf("CreateInstance failed: %v", err) t.Fatalf("CreateInstance failed: %v", err)
} }
// Simulate starting the instance // Start the instance (will use 'yes' command from test config)
inst.SetStatus(instance.Running) if err := inst.Start(); err != nil {
t.Fatalf("Failed to start instance: %v", err)
}
// Update running instance with new model // Update running instance with new model
newOptions := &instance.Options{ newOptions := &instance.Options{
@@ -210,10 +212,9 @@ func TestUpdateInstance(t *testing.T) {
t.Fatalf("UpdateInstance failed: %v", err) t.Fatalf("UpdateInstance failed: %v", err)
} }
// Should be either running or restarting after update // Should be running after update (was running before, should be restarted)
status := updated.GetStatus() if !updated.IsRunning() {
if status != instance.Running && status != instance.Restarting { t.Errorf("Instance should be running after update, got: %v", updated.GetStatus())
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" {