@@ -76,6 +76,8 @@ func TestEngineHTTPClients_BoundResponseHeaderWait(t *testing.T) {
7676 require .Equal (t , ollamaLoadResponseHeaderTimeout , responseHeaderTimeout (t , ex .ollamaLoadClient ), "Ollama load response-header timeout" )
7777}
7878
79+ // A cold Ollama model load can delay response headers. Only that action gets the
80+ // longer budget, so unrelated operations still detect an unresponsive engine quickly.
7981func TestOnlyOllamaRunModel_UsesSlowResponseHeaderBudget (t * testing.T ) {
8082 srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , _ * http.Request ) {
8183 time .Sleep (100 * time .Millisecond )
@@ -229,6 +231,8 @@ func TestEngineLifecycle_DetectsStartsReportsHealthAndStops(t *testing.T) {
229231 require .False (t , st .Running , "expected stopped (%v)" , st )
230232}
231233
234+ // Another application can claim the port after a managed process crashes.
235+ // Restart must recognize that owner instead of spawning a competing process.
232236func TestCrashThenExternalService_IsAdoptedWithoutRespawn (t * testing.T ) {
233237 port , err := freePort ()
234238 require .NoError (t , err )
@@ -595,6 +599,8 @@ func TestAdoptedEngine_ReportsObservedLiveness(t *testing.T) {
595599 require .False (t , st .Healthy , "closed external listener remained present (%v)" , st )
596600}
597601
602+ // The proxy also answers health requests on loopback. The identity probe must
603+ // distinguish it from Ollama, or forwarding can route requests back into the proxy.
598604func TestProxyFacade_CannotIdentifyAsOllama (t * testing.T ) {
599605 var probes atomic.Int32
600606 srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
@@ -636,6 +642,8 @@ func TestProxyFacade_CannotIdentifyAsOllama(t *testing.T) {
636642 require .NotEqual (t , int32 (0 ), probes .Load (), "engine identity probe did not carry the proxy sentinel" )
637643}
638644
645+ // A successful earlier identity check does not identify a new listener on the
646+ // same port. Losing that identity must block adoption and installation.
639647func TestPreviouslyAdoptedForeignReplacement_FailsClosed (t * testing.T ) {
640648 var isOllama atomic.Bool
641649 isOllama .Store (true )
0 commit comments