feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
42
app/models/check_metric_test.go
Обычный файл
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user