iop/packages/go/config/provider_stall_timeout_test.go
toki fef1f7a9dc feat(liveness): provider 실행 stall 관측을 구현한다
Node의 provider progress 기반 stall timeout, watchdog fencing과 bounded health probe evidence를 실행 경로에 반영한다. Edge-Node 계약과 구현 스펙, 테스트 및 Milestone 완료 evidence를 현재 상태와 맞춘다.
2026-08-05 09:45:14 +09:00

44 lines
1.4 KiB
Go

package config_test
import (
"math"
"strings"
"testing"
"time"
"iop/packages/go/config"
"iop/packages/go/execution"
)
func TestNodeProviderResponseStallTimeoutValidation(t *testing.T) {
for _, tc := range []struct {
name string
raw int64
want int64
bad bool
}{
{name: "omitted defaults", want: execution.DefaultResponseStallTimeoutMS},
{name: "positive preserved", raw: 60000, want: 60000},
{name: "exact safe boundary preserved", raw: math.MaxInt64 / int64(time.Millisecond), want: math.MaxInt64 / int64(time.Millisecond)},
{name: "first overflowing millisecond rejected", raw: math.MaxInt64/int64(time.Millisecond) + 1, bad: true},
{name: "negative rejected", raw: -1, bad: true},
{name: "overflow rejected", raw: 99999999999999, bad: true},
} {
t.Run(tc.name, func(t *testing.T) {
provider := config.NodeProviderConf{ID: "p1", Type: "vllm", Category: config.CategoryAPI, Models: []string{"m"}, ResponseStallTimeoutMS: tc.raw}
err := provider.Validate()
if (err != nil) != tc.bad {
t.Fatalf("Validate() error = %v, want bad=%t", err, tc.bad)
}
if tc.bad {
if !strings.Contains(err.Error(), "response_stall_timeout_ms") {
t.Fatalf("error = %q", err)
}
return
}
if got := provider.EffectiveResponseStallTimeoutMS(); got != tc.want {
t.Errorf("effective timeout = %d, want %d", got, tc.want)
}
})
}
}