forked from libp2p/go-libp2p-routing-helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpubkey_test.go
51 lines (46 loc) · 1.02 KB
/
pubkey_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package routinghelpers
import (
"context"
"testing"
"github.com/libp2p/go-libp2p/core/routing"
"github.com/libp2p/go-libp2p/core/test"
)
func TestGetPublicKey(t *testing.T) {
d := Parallel{
Routers: []routing.Routing{
Parallel{
Routers: []routing.Routing{
&Compose{
ValueStore: &LimitedValueStore{
ValueStore: new(dummyValueStore),
Namespaces: []string{"other"},
},
},
},
},
Tiered{
Routers: []routing.Routing{
&Compose{
ValueStore: &LimitedValueStore{
ValueStore: new(dummyValueStore),
Namespaces: []string{"pk"},
},
},
},
},
&Compose{
ValueStore: &LimitedValueStore{
ValueStore: new(dummyValueStore),
Namespaces: []string{"other", "pk"},
},
},
&struct{ Compose }{Compose{ValueStore: &LimitedValueStore{ValueStore: Null{}}}},
&struct{ Compose }{},
},
}
pid, _ := test.RandPeerID()
ctx := context.Background()
if _, err := d.GetPublicKey(ctx, pid); err != routing.ErrNotFound {
t.Fatal(err)
}
}