Merge pull request #7854 from matheusdtech/itest-network-conn
itest: bind to local addr in network test
This commit is contained in:
2 files changed
+13
-4
No files matched your search
@@ -148,6 +148,9 @@ unlock or create.
|
|||||||
* [Simplify fuzz tests](https://github.com/lightningnetwork/lnd/pull/7709)
|
* [Simplify fuzz tests](https://github.com/lightningnetwork/lnd/pull/7709)
|
||||||
using the `require` package.
|
using the `require` package.
|
||||||
|
|
||||||
|
* [Removed](https://github.com/lightningnetwork/lnd/pull/7854) need for an
|
||||||
|
active internet connection for the network connection itest.
|
||||||
|
|
||||||
## `lncli`
|
## `lncli`
|
||||||
|
|
||||||
* Added ability to use [ENV variables to override `lncli` global flags](https://github.com/lightningnetwork/lnd/pull/7693). Flags will have preference over ENVs.
|
* Added ability to use [ENV variables to override `lncli` global flags](https://github.com/lightningnetwork/lnd/pull/7693). Flags will have preference over ENVs.
|
||||||
|
|||||||
@@ -17,14 +17,20 @@ import (
|
|||||||
// effect. It creates a node with a small connection timeout value, and
|
// effect. It creates a node with a small connection timeout value, and
|
||||||
// connects it to a non-routable IP address.
|
// connects it to a non-routable IP address.
|
||||||
func testNetworkConnectionTimeout(ht *lntest.HarnessTest) {
|
func testNetworkConnectionTimeout(ht *lntest.HarnessTest) {
|
||||||
|
// Bind to a random port on localhost but never actually accept any
|
||||||
|
// connections. This makes any connection attempts timeout.
|
||||||
|
l, err := net.Listen("tcp", "127.0.0.1:0")
|
||||||
|
require.NoError(ht, err)
|
||||||
|
defer l.Close()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// testPub is a random public key for testing only.
|
// testPub is a random public key for testing only.
|
||||||
testPub = "0332bda7da70fefe4b6ab92f53b3c4f4ee7999" +
|
testPub = "0332bda7da70fefe4b6ab92f53b3c4f4ee7999" +
|
||||||
"f312284a8e89c8670bb3f67dbee2"
|
"f312284a8e89c8670bb3f67dbee2"
|
||||||
|
|
||||||
// testHost is a reachable IP address with an unreachable port
|
// testHost is the previously bound address that will never
|
||||||
// that's used for testing only.
|
// accept any conns.
|
||||||
testHost = "lightning.engineering:81"
|
testHost = l.Addr().String()
|
||||||
)
|
)
|
||||||
|
|
||||||
// First, test the global timeout settings.
|
// First, test the global timeout settings.
|
||||||
@@ -62,7 +68,7 @@ func testNetworkConnectionTimeout(ht *lntest.HarnessTest) {
|
|||||||
dave := ht.NewNode("Dave", nil)
|
dave := ht.NewNode("Dave", nil)
|
||||||
|
|
||||||
// Try to connect Dave to a non-routable IP address, using a timeout
|
// Try to connect Dave to a non-routable IP address, using a timeout
|
||||||
// value of 1ms, which should give us a timeout error immediately.
|
// value of 1s, which should give us a timeout error immediately.
|
||||||
req = &lnrpc.ConnectPeerRequest{
|
req = &lnrpc.ConnectPeerRequest{
|
||||||
Addr: &lnrpc.LightningAddress{
|
Addr: &lnrpc.LightningAddress{
|
||||||
Pubkey: testPub,
|
Pubkey: testPub,
|
||||||
|
|||||||
Reference in new issue
Block a user