MCPcopy Create free account
hub / github.com/blobcache/blobcache / TestMultiNode

Function TestMultiNode

src/bclocal/api_test.go:25–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestMultiNode(t *testing.T) {
26 t.Parallel()
27 blobcachetests.TestMultiNode(t, func(t testing.TB, n int) []blobcache.Service {
28 ctx := testutil.Context(t)
29 loc := &testPeerLocator{}
30 svcs := make([]blobcache.Service, n)
31 for i := range svcs {
32 env := bclocal.NewTestEnv(t)
33 env.PeerLocator = loc
34 svc := bclocal.NewTestServiceFromEnv(t, env)
35 for j := range svcs[:i] {
36 ep, err := svcs[j].Endpoint(ctx)
37 require.NoError(t, err)
38 require.NoError(t, svc.Ping(ctx, ep))
39 }
40 ep, err := svc.Endpoint(ctx)
41 require.NoError(t, err)
42 loc.Add(ep)
43 svcs[i] = svc
44 }
45 return svcs
46 })
47}
48
49// testPeerLocator is a PeerLocator that maps PeerIDs to addresses
50// based on endpoints registered via Add.

Callers

nothing calls this directly

Calls 7

AddMethod · 0.95
TestMultiNodeFunction · 0.92
ContextFunction · 0.92
NewTestEnvFunction · 0.92
NewTestServiceFromEnvFunction · 0.92
EndpointMethod · 0.65
PingMethod · 0.45

Tested by

no test coverage detected