MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / TestIPv6Seed

Function TestIPv6Seed

route/ipv6seed_test.go:37–105  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35const IntergrationTestDomain = "bp00.intergrationtest.gridb.io"
36
37func TestIPv6Seed(t *testing.T) {
38 isc := IPv6SeedClient{}
39 log.SetLevel(log.DebugLevel)
40 Convey("", t, func() {
41 var pub asymmetric.PublicKey
42 _ = pub.UnmarshalBinary(
43 []byte{2, 151, 232, 88, 201, 127, 111, 128,
44 208, 117, 192, 223, 212, 5, 209, 42,
45 214, 62, 89, 253, 18, 51, 73, 188,
46 178, 136, 185, 2, 158, 56, 217, 104, 154})
47
48 node := proto.Node{
49 ID: proto.NodeID("0000000001f26f2145dc770edc385806c6ef131a472ea9ae0f9073d03b4b96d8"),
50 Addr: "111.111.111.111:11111",
51 PublicKey: &pub,
52 Nonce: cpuminer.Uint256{1, 2, 3, 4},
53 }
54
55 out, err := isc.GenBPIPv6(&node, TestDomain)
56 if err != nil {
57 t.Errorf("gen ipv6 failed: %v", err)
58 return
59 }
60 log.Debug(out)
61
62 nodeBuf, err := utils.EncodeMsgPack(node)
63 if err != nil {
64 t.Errorf("marshal node info failed: %v", err)
65 return
66 }
67 log.Debugf("node: %s", nodeBuf)
68
69 m, err := isc.GetBPFromDNSSeed(TestDomain)
70 So(err, ShouldBeNil)
71 So(len(m), ShouldEqual, 1)
72 So(m[*node.ID.ToRawNodeID()].ID, ShouldResemble, node.ID)
73 So(m[*node.ID.ToRawNodeID()].Addr, ShouldResemble, node.Addr)
74 So(m[*node.ID.ToRawNodeID()].PublicKey.Serialize(), ShouldResemble, node.PublicKey.Serialize())
75 So(m[*node.ID.ToRawNodeID()].Nonce, ShouldResemble, node.Nonce)
76 })
77 Convey(IntergrationTestDomain, t, func() {
78 var pub asymmetric.PublicKey
79 pubKeyBytes, _ := hex.DecodeString("02c76216704d797c64c58bc11519fb68582e8e63de7e5b3b2dbbbe8733efe5fd24")
80 _ = pub.UnmarshalBinary(pubKeyBytes)
81
82 node := proto.Node{
83 ID: proto.NodeID("00000bef611d346c0cbe1beaa76e7f0ed705a194fdf9ac3a248ec70e9c198bf9"),
84 Addr: "127.0.0.1:3122",
85 PublicKey: &pub,
86 Nonce: cpuminer.Uint256{313283, 0, 0, 0},
87 }
88
89 out, err := isc.GenBPIPv6(&node, IntergrationTestDomain)
90 if err != nil {
91 t.Errorf("gen ipv6 failed: %v", err)
92 return
93 }
94 log.Debug(out)

Callers

nothing calls this directly

Calls 11

UnmarshalBinaryMethod · 0.95
GenBPIPv6Method · 0.95
GetBPFromDNSSeedMethod · 0.95
SetLevelFunction · 0.92
NodeIDTypeAlias · 0.92
DebugFunction · 0.92
EncodeMsgPackFunction · 0.92
DebugfFunction · 0.92
ErrorfMethod · 0.80
ToRawNodeIDMethod · 0.80
SerializeMethod · 0.45

Tested by

no test coverage detected