Switch the project language to English

Comments, doc comments, test names, error and log messages, CLI help, README,
Makefile, CI step names and the design document are now all in English.
No behaviour changes; the full suite passes under the race detector.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ilkerandClaude Opus 5 committed 2026-09-16 01:15:21 +02:00
1 parent b7417e1a69
commit 28029eb43b
21 files changed
+910 -869

No files matched your search

+45 -44
View File
@@ -50,7 +50,7 @@ func TestChatCompletionsBuffered(t *testing.T) {
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
t.Fatalf("durum %d", resp.StatusCode)
t.Fatalf("status %d", resp.StatusCode)
}
var out struct {
@@ -75,17 +75,17 @@ func TestChatCompletionsBuffered(t *testing.T) {
t.Fatalf("choices=%d", len(out.Choices))
}
if n := len(strings.Fields(out.Choices[0].Message.Content)); n != 7 {
t.Errorf("beklenen 7 token, alınan %d", n)
t.Errorf("expected 7 tokens, got %d", n)
}
if out.Usage.CompletionTokens != 7 {
t.Errorf("usage.completion_tokens=%d", out.Usage.CompletionTokens)
}
if out.Usage.TotalTokens != out.Usage.PromptTokens+out.Usage.CompletionTokens {
t.Error("usage toplamı tutarsız")
t.Error("usage totals are inconsistent")
}
}
// sseEvent, SSE akışından çözülmüş tek bir olay.
// sseEvent is one decoded event from an SSE stream.
type sseEvent struct {
raw string
data map[string]any
@@ -107,7 +107,7 @@ func readSSE(t *testing.T, body *bufio.Reader) []sseEvent {
ev := sseEvent{raw: payload}
if payload != "[DONE]" {
if err := json.Unmarshal([]byte(payload), &ev.data); err != nil {
t.Fatalf("SSE yükü çözülemedi: %v (%q)", err, payload)
t.Fatalf("could not decode SSE payload: %v (%q)", err, payload)
}
}
out = append(out, ev)
@@ -132,10 +132,10 @@ func TestChatCompletionsStreaming(t *testing.T) {
events := readSSE(t, bufio.NewReader(resp.Body))
if len(events) == 0 {
t.Fatal("hiç SSE olayı gelmedi")
t.Fatal("no SSE events received")
}
if last := events[len(events)-1]; last.raw != "[DONE]" {
t.Errorf("akış [DONE] ile bitmedi: %q", last.raw)
t.Errorf("stream did not end with [DONE]: %q", last.raw)
}
var contentTokens, usageChunks, finishChunks int
@@ -163,17 +163,17 @@ func TestChatCompletionsStreaming(t *testing.T) {
}
if contentTokens != 5 {
t.Errorf("beklenen 5 içerik chunk'ı, alınan %d", contentTokens)
t.Errorf("expected 5 content chunks, got %d", contentTokens)
}
if finishChunks != 1 {
t.Errorf("beklenen 1 finish_reason chunk'ı, alınan %d", finishChunks)
t.Errorf("expected 1 finish_reason chunk, got %d", finishChunks)
}
if usageChunks != 1 {
t.Errorf("include_usage istendi ama %d usage chunk'ı geldi", usageChunks)
t.Errorf("include_usage was requested but got %d usage chunks", usageChunks)
}
}
func TestStreamingUsageIstenmezseGonderilmez(t *testing.T) {
func TestStreamingOmitsUsageUnlessRequested(t *testing.T) {
srv := newTestServer(t, testConfig())
resp := postJSON(t, srv.URL+"/v1/chat/completions", map[string]any{
@@ -188,13 +188,14 @@ func TestStreamingUsageIstenmezseGonderilmez(t *testing.T) {
continue
}
if _, ok := ev.data["usage"]; ok {
t.Error("istenmediği halde usage chunk'ı gönderildi")
t.Error("usage chunk sent although it was not requested")
}
}
}
func TestIstemciKopmasiEngineeYansir(t *testing.T) {
// Faz 1'in çıkış kriterinin temeli: istemci koptuğunda GPU boşa çalışmamalı.
func TestClientDisconnectReachesEngine(t *testing.T) {
// The basis of phase 1's exit criterion: when a client disconnects the GPU
// must stop working on that request.
cfg := testConfig()
cfg.DecodeTokensPerSec = 20
eng := New(cfg)
@@ -220,7 +221,7 @@ func TestIstemciKopmasiEngineeYansir(t *testing.T) {
t.Fatal(err)
}
// İlk token'ı bekle, sonra istemciyi kopar.
// Wait for the first token, then drop the client.
waitFor(t, 2*time.Second, func() bool { return eng.Stats().Running == 1 })
cancel()
_ = resp.Body.Close()
@@ -231,7 +232,7 @@ func TestIstemciKopmasiEngineeYansir(t *testing.T) {
})
}
func TestCompletionsUcNoktasi(t *testing.T) {
func TestCompletionsEndpoint(t *testing.T) {
srv := newTestServer(t, testConfig())
resp := postJSON(t, srv.URL+"/v1/completions", map[string]any{
@@ -252,11 +253,11 @@ func TestCompletionsUcNoktasi(t *testing.T) {
t.Errorf("object=%q", out.Object)
}
if n := len(strings.Fields(out.Choices[0].Text)); n != 3 {
t.Errorf("beklenen 3 token, alınan %d", n)
t.Errorf("expected 3 tokens, got %d", n)
}
}
func TestModelsVeHealth(t *testing.T) {
func TestModelsAndHealth(t *testing.T) {
cfg := testConfig()
cfg.Model = "llama-3.3-70b"
srv := newTestServer(t, cfg)
@@ -267,7 +268,7 @@ func TestModelsVeHealth(t *testing.T) {
}
resp.Body.Close()
if resp.StatusCode != http.StatusOK {
t.Errorf("/health durum %d", resp.StatusCode)
t.Errorf("/health status %d", resp.StatusCode)
}
resp, err = http.Get(srv.URL + "/v1/models") //nolint:noctx // test
@@ -285,17 +286,17 @@ func TestModelsVeHealth(t *testing.T) {
t.Fatal(err)
}
if len(out.Data) != 1 || out.Data[0].ID != "llama-3.3-70b" {
t.Errorf("/v1/models beklenen modeli listelemedi: %+v", out.Data)
t.Errorf("/v1/models did not list the expected model: %+v", out.Data)
}
}
// TestMetriklerPrometheusIleParseEdilebilir, §7.6'daki engine kontratını doğrular.
// Router bu metrikleri gerçek bir Prometheus parser'ıyla okuyacak; format
// bozuksa yönlendirme kör kalır.
func TestMetriklerPrometheusIleParseEdilebilir(t *testing.T) {
// TestMetricsParseWithPrometheus verifies the engine contract from plan §7.6.
// The router reads these metrics with a real Prometheus parser; if the format
// is wrong, routing goes blind.
func TestMetricsParseWithPrometheus(t *testing.T) {
srv := newTestServer(t, testConfig())
// Biraz trafik üret ki sayaçlar dolsun.
// Generate some traffic so the counters are non-zero.
resp := postJSON(t, srv.URL+"/v1/chat/completions", map[string]any{
"messages": []map[string]string{{"role": "user", "content": "merhaba dunya"}},
"max_tokens": 4,
@@ -308,26 +309,26 @@ func TestMetriklerPrometheusIleParseEdilebilir(t *testing.T) {
}
defer mresp.Body.Close()
// TextParser'ın sıfır değeri geçersiz; şema açıkça verilmeli.
// Legacy şema daha sıkı: metrik adlarımızın klasik Prometheus kurallarına
// uyduğunu da doğrulamış oluyoruz (vLLM adlarındaki ':' legacy'de de geçerli).
// TextParser's zero value is invalid; the scheme must be given explicitly.
// The legacy scheme is stricter, so this also checks our metric names obey
// classic Prometheus rules (the ':' in vLLM names is legal there too).
parser := expfmt.NewTextParser(model.LegacyValidation)
families, err := parser.TextToMetricFamilies(mresp.Body)
if err != nil {
t.Fatalf("metrikler parse edilemedi: %v", err)
t.Fatalf("metrics failed to parse: %v", err)
}
// §7.6 zorunlu üçlüsü.
// The three metrics plan §7.6 makes mandatory.
for _, name := range []string{
"vllm:num_requests_running",
"vllm:num_requests_waiting",
"vllm:kv_cache_usage_perc",
} {
if _, ok := families[name]; !ok {
t.Errorf("zorunlu metrik eksik: %s", name)
t.Errorf("mandatory metric missing: %s", name)
}
}
// Opsiyoneller ve histogramlar.
// Optional metrics and histograms.
for _, name := range []string{
"vllm:cache_config_info",
"vllm:prefix_cache_queries_total",
@@ -335,35 +336,35 @@ func TestMetriklerPrometheusIleParseEdilebilir(t *testing.T) {
"vllm:time_to_first_token_seconds",
} {
if _, ok := families[name]; !ok {
t.Errorf("metrik eksik: %s", name)
t.Errorf("metric missing: %s", name)
}
}
if f, ok := families["vllm:generation_tokens_total"]; ok {
if got := f.Metric[0].GetCounter().GetValue(); got != 4 {
t.Errorf("generation_tokens_total=%v, beklenen 4", got)
t.Errorf("generation_tokens_total=%v, expected 4", got)
}
} else {
t.Error("vllm:generation_tokens_total eksik")
t.Error("vllm:generation_tokens_total is missing")
}
}
// TestUsageCachedTokensRaporlanir, prefix cache etkisinin istemciye ulaştığını
// doğrular. Router ileride bunu kullanmayacak olsa da, cache'in gerçekten
// çalıştığını uçtan uca gösteren tek sinyal bu.
func TestUsageCachedTokensRaporlanir(t *testing.T) {
// TestUsageReportsCachedTokens verifies the prefix cache's effect reaches the
// client. The router will not consume this, but it is the only end-to-end
// signal that the cache actually works.
func TestUsageReportsCachedTokens(t *testing.T) {
srv := newTestServer(t, testConfig())
body := map[string]any{
"messages": []map[string]string{{"role": "user", "content": strings.Repeat("ortak onek. ", 100)}},
"messages": []map[string]string{{"role": "user", "content": strings.Repeat("shared prefix. ", 100)}},
"max_tokens": 3,
}
// İlk istek cache'i doldurur.
// The first request populates the cache.
resp := postJSON(t, srv.URL+"/v1/chat/completions", body)
resp.Body.Close()
// İkincisi aynı ön eki kullanmalı.
// The second one must reuse that prefix.
resp = postJSON(t, srv.URL+"/v1/chat/completions", body)
defer resp.Body.Close()
@@ -374,10 +375,10 @@ func TestUsageCachedTokensRaporlanir(t *testing.T) {
t.Fatal(err)
}
if out.Usage.PromptTokensDetails.CachedTokens == 0 {
t.Error("ikinci istekte cached_tokens 0; prefix cache istemciye raporlanmıyor")
t.Error("cached_tokens is 0 on the second request; prefix cache is not reported")
}
if out.Usage.PromptTokensDetails.CachedTokens > out.Usage.PromptTokens {
t.Errorf("cached_tokens (%d) prompt_tokens'tan (%d) büyük",
t.Errorf("cached_tokens (%d) exceeds prompt_tokens (%d)",
out.Usage.PromptTokensDetails.CachedTokens, out.Usage.PromptTokens)
}
}