MCPcopy
hub / github.com/grafana/dskit / TestServiceName

Function TestServiceName

services/basic_service_test.go:318–329  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

316}
317
318func TestServiceName(t *testing.T) {
319 s := NewIdleService(nil, nil).WithName("test name")
320 require.Equal(t, "test name", DescribeService(s))
321
322 ctx, cancel := context.WithCancel(context.Background())
323 defer cancel()
324 require.NoError(t, s.StartAsync(ctx))
325
326 // once service has started, BasicService will not allow changing the name
327 s.WithName("new")
328 require.Equal(t, "test name", DescribeService(s))
329}
330
331func TestListenerCancellationUnstartedService(t *testing.T) {
332 defer goleak.VerifyNone(t)

Callers

nothing calls this directly

Calls 5

NewIdleServiceFunction · 0.85
DescribeServiceFunction · 0.85
WithNameMethod · 0.80
StartAsyncMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected