feat: publish standalone worker

Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
Gleb Tv
2026-07-13 17:55:14 +03:00
Коммит 2c7a0236da
309 изменённых файлов: 44004 добавлений и 0 удалений

42
app/models/check_metric_test.go Обычный файл
Просмотреть файл

@@ -0,0 +1,42 @@
package models
import (
"testing"
"unicode"
"github.com/stretchr/testify/assert"
)
func TestCheckMetricName(t *testing.T) {
tests := []struct {
kind string
want string
}{
{"http", "chttp"},
{"ssl", "cssl"},
{"bssl", "cbssl"},
{"ssh", "cssh"},
{"ftp", "cftp"},
{"dns", "cdns"},
{"whois", "cwhois"},
{"rkn", "crkn"},
{"llm", "cllm"},
{"llm-http", "cllm_http"},
{"weird-kind", "cweird_kind"},
}
for _, tt := range tests {
t.Run(tt.kind, func(t *testing.T) {
c := &Check{Kind: tt.kind, ID: 1}
got := c.MetricName()
assert.Equal(t, tt.want, got, "MetricName() for kind %q", tt.kind)
metric := got
for _, ch := range metric {
if !unicode.IsLetter(ch) && !unicode.IsDigit(ch) && ch != '_' && ch != ':' {
t.Errorf("metric name %q contains invalid character %q", metric, ch)
}
}
})
}
}