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

Function withFixtures

kv/memberlist/memberlist_client_test.go:438–458  ·  view source on GitHub ↗
(t *testing.T, testFN func(t *testing.T, kv *Client))

Source from the content-addressed store, hash-verified

436}
437
438func withFixtures(t *testing.T, testFN func(t *testing.T, kv *Client)) {
439 t.Helper()
440
441 c := dataCodec{}
442
443 var cfg KVConfig
444 flagext.DefaultValues(&cfg)
445 cfg.TCPTransport = TCPTransportConfig{
446 BindAddrs: getLocalhostAddrs(),
447 }
448 cfg.Codecs = []codec.Codec{c}
449
450 mkv := NewKV(cfg, log.NewNopLogger(), &staticDNSProviderMock{}, prometheus.NewPedanticRegistry())
451 require.NoError(t, services.StartAndAwaitRunning(context.Background(), mkv))
452 defer services.StopAndAwaitTerminated(context.Background(), mkv) //nolint:errcheck
453
454 kv, err := NewClient(mkv, c)
455 require.NoError(t, err)
456
457 testFN(t, kv)
458}
459
460func TestCASNoOutput(t *testing.T) {
461 withFixtures(t, func(t *testing.T, kv *Client) {

Callers 6

TestCASNoOutputFunction · 0.70
TestCASErrorNoRetryFunction · 0.70
TestCASErrorWithRetriesFunction · 0.70
TestCASNoChangeFunction · 0.70

Calls 7

DefaultValuesFunction · 0.92
StartAndAwaitRunningFunction · 0.92
StopAndAwaitTerminatedFunction · 0.92
getLocalhostAddrsFunction · 0.85
NewKVFunction · 0.85
HelperMethod · 0.80
NewClientFunction · 0.70

Tested by

no test coverage detected