add bootnodes test

This commit is contained in:
jangko 2022-02-27 11:53:11 +07:00
parent 622e6489d8
commit 6c4d04562d
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 19 additions and 2 deletions

View File

@ -8,7 +8,7 @@ const
"enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", # bootnode-azure-koreasouth-001 "enode://715171f50508aba88aecd1250af392a45a330af91d7b90701c436b618c86aaa1589c9184561907bebbb56439b8f8787bc01f49a7c77276c58c1b09822d75e8e8@52.231.165.108:30303", # bootnode-azure-koreasouth-001
"enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", # bootnode-azure-westus-001 "enode://5d6d7cd20d6da4bb83a1d28cadb5d409b64edf314c0335df658c1a54e32c7c4a7ab7823d57c39b6a757556e68ff1df17c748b698544a55cb488b52479a92b60f@104.42.217.25:30303", # bootnode-azure-westus-001
"enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", # bootnode-hetzner-hel "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", # bootnode-hetzner-hel
"enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", # bootnode-hetzner-fsn "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303", # bootnode-hetzner-fsn
# Ethereum Foundation C++ Bootnodes # Ethereum Foundation C++ Bootnodes
"enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303" # DE "enode://979b7fa28feeb35a4741660a16076f1943202cb72b6af70d327f053e248bab9ba81760f39d0701ef1d8f89cc1fbd2cacba0710a12cd5314d5e0c9021aa3637f9@5.1.83.226:30303" # DE
] ]

View File

@ -12,7 +12,7 @@
import import
std/[net, options], std/[net, options],
unittest2, unittest2,
../../eth/p2p/enode ../../eth/p2p/[enode, bootnodes]
suite "ENode": suite "ENode":
test "Go-Ethereum tests": test "Go-Ethereum tests":
@ -92,3 +92,20 @@ suite "ENode":
check (results[index].isSome and res.error == results[index].get) or check (results[index].isSome and res.error == results[index].get) or
res.isOk res.isOk
test "Bootnodes test":
proc runBNTest(bns: openArray[string]): bool =
for z in bns:
let res = ENode.fromString(z)
if res.isErr: return false
true
check runBNTest(MainnetBootnodes)
check runBNTest(RopstenBootnodes)
check runBNTest(RinkebyBootnodes)
check runBNTest(GoerliBootnodes)
check runBNTest(DiscoveryV5Bootnodes)
check runBNTest(KovanBootnodes)
check runBNTest(StatusBootNodes)
check runBNTest(StatusBootNodesStaging)
check runBNTest(StatusBootNodesTest)