MCPcopy
hub / github.com/grafana/tempo / TestDrain_Train_MinTokensEnforcement

Function TestDrain_Train_MinTokensEnforcement

pkg/drain/drain_test.go:121–136  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func TestDrain_Train_MinTokensEnforcement(t *testing.T) {
122 t.Parallel()
123
124 config := DefaultConfig()
125 config.MinTokens = 3 // Need at least 3 tokens
126 drain := New("test-tenant", config)
127
128 // Span name that will tokenize to less than MinTokens
129 // Single character will tokenize to ["a", "<END>"] which is 2 tokens < 3
130 cluster := drain.Train("a")
131 require.Nil(t, cluster, "should return nil for span with too few tokens")
132
133 // Valid span name should work
134 cluster = drain.Train("GET /api/users")
135 require.NotNil(t, cluster, "should accept valid span name")
136}
137
138func TestDrain_Train_MaxTokensEnforcement(t *testing.T) {
139 t.Parallel()

Callers

nothing calls this directly

Calls 3

DefaultConfigFunction · 0.85
TrainMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected