Files
LocalAI/pkg/grpc/client_busy_test.go
Richard Palethorpe 9c43b2da8f fix(model): make backend shutdown model-scoped (#10865)
Avoid holding the global loader lock across backend lifecycle waits and propagate forced shutdown through distributed workers. Track parallel requests with in-flight counters and reserve worker ports until process termination.

Add focused race tests and an authoritative FizzBee lifecycle model with a fail-closed conformance target.

Assisted-by: Codex:GPT-5 [FizzBee] [Ginkgo]

Signed-off-by: Richard Palethorpe <io@richiejp.com>
2026-07-19 08:43:17 +02:00

28 lines
613 B
Go

package grpc
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Client busy accounting", func() {
It("remains busy until every parallel operation completes", func() {
client := &Client{parallel: true}
client.setBusy(true)
client.setBusy(true)
client.setBusy(false)
Expect(client.IsBusy()).To(BeTrue())
client.setBusy(false)
Expect(client.IsBusy()).To(BeFalse())
})
It("does not underflow on a redundant completion", func() {
client := &Client{parallel: true}
client.setBusy(false)
client.setBusy(true)
Expect(client.IsBusy()).To(BeTrue())
})
})