Commit Graph

67 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
1ca53ae906
test: decrease trickleDelay in integration tests to 50ms 2017-11-15 18:26:22 -08:00
Laura Cressman
ed6ad22e85 config+server+networktest: make trickleDelay configurable
Add option to set trickleDelay for AuthenticatedGossiper in
command line, with default value of 300 milliseconds. Pass this
value to newServer, which uses it when creating a new instance of
AuthenticatedGossiper. Also set this value to 300 milliseconds when
creating nodes in integration tests.
2017-11-15 16:50:19 -08:00
Jim Posen
7d65ad4302 lnd: Ensure networkWatcher goroutine exits when harness is stopped. 2017-11-13 20:52:07 -08:00
Jim Posen
923dd9ac30 lnd: Better error handling in lightningNode.Start().
There is an issue currently where if an error occurs in Start() before
the LightningClient is initialized, the process won't be killed and
the program will segfault (because Stop() tries to call a method on
the nil LightningClient). This handles some of those edge cases.
2017-11-13 20:52:07 -08:00
Jim Posen
643c23f978 lnd: Improve error handling for node failures in integration tests.
If an lnd node encounters a fatal process errors, we now log the error
asynchronously, instead of calling Fatalf on the test instance. This
is because calling Fatalf in a separate goroutine does not actually
end the test immediately as expected, but rather just kills the
goroutine. This ensures that we see server errors on all nodes before
the test process exits.
2017-11-13 20:52:07 -08:00
Johan T. Halseth
2c2d18ee10 networktest: --noencryptwallet for test nodes
This commit adds the --noencryptwallet flag to integration test
nodes,  causing them to be operational during the tests without
having to provide a password over rpc.
2017-10-19 19:17:35 -07:00
Olaoluwa Osuntokun
f3b8c912b4
test: bump up logging level for integration test nodes to debug
In light of the recent commit which added a new set of logging in the
debug verbosity and the commit which added exporting logs from test
execution to Travis, we’ve now bumped up the logging level to debug.
With this new set of logging infrastructure, we should be able to
quickly debug any issues or flakes in the integration tests running on
CI.
2017-10-17 19:44:12 -07:00
Olaoluwa Osuntokun
53500127e3
test+config: add new --nobootstrap option to disable connection bootstrapping
This commit adds a new config option to allow callers to optionally
disable connection bootstrapping. This may be desirable for several
reasons, but primary, we add this so we can keep our integration tests
under the same context as before bootstrapping existed.
2017-09-03 17:05:05 -07:00
Olaoluwa Osuntokun
9f0efddc20
multi: switch from btcrpcclient to rpcclient 2017-08-24 18:54:24 -07:00
bryanvu
c87678e695 test: reposition context creation and extend TLS timeout
Fixes timeouts during integration tests on slower machines.
2017-08-19 16:42:33 -07:00
Alex
922b065de5 main: integrate macaroons into config, startup, and RPC server 2017-08-17 19:20:41 -07:00
Alex
58c6989e74 tests: fix several timeout issues 2017-08-14 17:02:31 -07:00
Olaoluwa Osuntokun
143e7bdf5f
test: ensure nodes spun up by test framework use fresh config files
This commit modifies the way the nodes spun up the by test framework
are created such that they don’t use the configuration parameters
storage in the normal lnd home directory. Otherwise, tests would pick
up the configuration of the user’s pre-existing lnd nodes.
2017-08-10 22:00:53 -07:00
Olaoluwa Osuntokun
43b736225b
multi: add new method to generate fresh node announcments 2017-08-04 18:32:33 -07:00
Alex
59f9065213 rpc: force TLS for both grpc endpoint and grpc gateway 2017-08-03 18:21:22 -07:00
Alex
24db310aef networktest: use StopDaemon RPC to stop lnd instead of SIGINT 2017-08-01 18:33:12 -07:00
Olaoluwa Osuntokun
216cc3f919
test: update open channel methods in the testing framework 2017-07-30 17:51:54 -07:00
Olaoluwa Osuntokun
f9f9d68543
test: ensure the WaitForBlockchainSync grouting always exits
This commit fixes a minor bug in the goroutine that’s launched to check
the sync status of a particular node. Previously, the goroutine could
end up infinitely stuck on a send as once the chain has been detected
as synced, it didn't exit.

We fix this now by ensure that the goroutine always terminates after
the initial notification to the caller. Additionally, we not ensure
that both the internal and exterior goroutine are both reading off of
the peer’s quit channel.
2017-07-11 16:29:35 -07:00
Johan T. Halseth
2e6800e1ed integration tests: add -logoutput flag that can be used to log output from the seed nodes to files. 2017-07-06 18:41:21 -07:00
Olaoluwa Osuntokun
3b1db2b186
test: update integration test set up to reflect recent RPC change
A prior commit modified the walletbalance RPC to return satoshi instead
of BTC. As a result, we need to update the SetUp method in the
networkHarness to ensure we expect the proper value when asserting
wallet balances.
2017-07-04 15:53:06 -07:00
BitfuryLightning
e324fe5818 test: ensure blocks are synchronized before opening channels, allow more time for sync payments
Fix bug with synchronizing blockchain by adding several retries. Allow
to launch individual tests. Increase timeout for async payments.

Fixes #213.
2017-06-19 15:53:52 +02:00
afederigo
1eaa522265 tests: add test case "disconnecting target peer"
Issue: 139

This commit contains test case "disconnecting target peer" (second test case) which takes two
connected peers, then checks via assert method one connection exists,
then disconnects this remote peer by passing pubKey parameter (just some string) into RPC-call method. Then checks 0
connection exists, and then connects disconnected peer for passing
further tests, and then checks one connection exists.
2017-05-05 14:24:25 -07:00
Olaoluwa Osuntokun
bf927eb507
test: update args when launching nodes in integration testing framework
This commit updates the command line arguments used when launching a
node within the integration testing framework to be aware of the new
chain-specific namespace groups in the configuration options.
2017-05-02 19:57:55 -07:00
Olaoluwa Osuntokun
2f08337ccd
test: allow lightningNetworkWatcher to gracefully exit when ntfn pending 2017-04-20 16:06:42 -07:00
Olaoluwa Osuntokun
e947162d97
test: signal the process for exit before shutting down local goroutines
This commit is tied to the prior commit and it patches up a lingering
race condition and deadlock that can arise due to now properly waiting
for all goroutine  to exit before concluding the shutdown process.
2017-04-17 16:09:52 -07:00
Olaoluwa Osuntokun
bfdb2bebe2
test: bind the inner lightningNetworkWatcher goroutine to the wait group
This commit fixes a race condition detected by the race condition
detector that can be triggered by the lightnignNode exiting while the
underlying node is still active. Since the wait group wasn’t tied to
this cog routine, when the main process was exiting, it wouldn’t also
wait for this grouting to exit, thus triggering a race condition of
modifying the channel reference while reading for it.

The fix for this is straightforward: we now ensure that the goroutine
is factored into the struct level wait group.
2017-04-17 16:07:08 -07:00
Olaoluwa Osuntokun
4939443512
test: fix race condition in framework by waiting for goroutine exit 2017-04-17 12:39:49 -07:00
Olaoluwa Osuntokun
610f42ad5a
test: avoid double chan close in integration testing framework 2017-04-16 15:24:53 -07:00
Olaoluwa Osuntokun
07437f6ec4
test: update the ConnectPeer framework method to block until connect
This commit modifies the ConnectPeer method on the testing framework to
block (with a timeout) until the target peer is actually detected as
being connected. This was added as the peer connection logic was made
to be more asynchronous in a prior commit.
2017-04-13 15:11:24 -07:00
bryanvu
c9c2848427 server: user NodeAnnouncement addresses and ports for reconnect
Use addresses and ports from NodeAnnouncement messages for reconnection
attempts. For those nodes that don't explicitly report IP addresses, use
the IP address from previous connections connection request along with
the default peer port number.
2017-03-29 12:03:43 -07:00
Andrey Samokhvalov
9dfaca1632 linter: fix new warnings 2017-03-17 12:53:15 -07:00
Olaoluwa Osuntokun
57a7d58ef9
test: don't panic within lightningNetworkWatcher if lnd is shutting down
This commit fixes an issue in the newly added integration tests level
topology notifications that caused tests to erronosely panic when the
daemon was detected to be shutting down. This issue was notified by
AndrewSamokhvalov.

We fix this issue by checking if the error is a shutdown error, and
exiting early if so. Additionally we add a fail-fast case if the quit
channel for the node has already been closed.
2017-03-16 12:15:42 -07:00
Olaoluwa Osuntokun
a179a3adbb
test: modify new network announcement hook to be in node level
This commit modifies the two newly added network announcement hook stop
be at the lightningNode level rather than on the level of the entire
test framework. With this, callers are now able to better utilize the
newly added RPC’s since they can target particular peers and wait for
network messages to be processed rather then depending on a single node
(Alice) for information about the announcements propagated within the
network.
2017-03-14 20:07:52 -07:00
Olaoluwa Osuntokun
19f33d4faf
test: add ability to register for LN channel notification to framework
This commit adds the ability for test authors using the integration
testing framework to hook into real-time notifications for
network-level announcements concerning channel openings, closings, and
updates. With this commit we should be able to eliminate a number of
the sleeps within the test framework with synchronous calls (time outs)
to the new methods added in this PR.
2017-03-14 20:07:46 -07:00
Andrey Samokhvalov
deca1926d1 networktest: fix race condition 2017-03-13 16:30:23 -07:00
Andrey Samokhvalov
8fb54782e2 lnd: fix gosimple warnings 2017-03-13 16:30:23 -07:00
bryanvu
d911107ec6 fundingmanager: Update tests for funding manager persistence
This commit adds the FundingManagerPersistence test to ensure that the
funding process completes as expected when nodes shutdown after the the
funding transaction has been broadcast. Note that the final parts of
several wallet tests have been removed, as functionality has been moved
to the Funding Manager and should now be tested there.
2017-02-24 11:37:33 -08:00
bryanvu
e549a3f0ed fundingmanager: move final funding steps from wallet to funding manager.
Once a channel funding process has advanced to the point of broadcasting
the funding transaction, the state of the channel should be persisted
so that the nodes can disconnect or go down without having to wait for the
funding transaction to be confirmed on the blockchain.

Previously, the finalization of the funding process was handled by a
combination of the funding manager, the peer and the wallet, but if
the remote peer is no longer online or no longer connected, this flow
will no longer work. This commit moves all funding steps following
the transaction broadcast into the funding manager, which is available
as long as the daemon is running.
2017-02-24 11:37:33 -08:00
Olaoluwa Osuntokun
e910b12d33
lnd: fix issues reported by golint+govet
github.com/lightningnetwork/lnd  master ✗

                                           0m ◒
▶ golint
htlcswitch.go:292:4: should replace numUpdates += 1 with numUpdates++
htlcswitch.go:554:6: var onionId should be onionID
htlcswitch.go:629:7: var onionId should be onionID
lnd_test.go:133:1: context.Context should be the first parameter of a
function
lnd_test.go:177:1: context.Context should be the first parameter of a
function
networktest.go:84:2: struct field nodeId should be nodeID
peer.go:1704:16: should omit 2nd value from range; this loop is
equivalent to `for invoice := range ...`
rpcserver.go:57:6: func newRpcServer should be newRPCServer

github.com/lightningnetwork/lnd  master ✗

                                        9m ⚑ ◒  ⍉
▶ go vet
features.go:12: github.com/lightningnetwork/lnd/lnwire.Feature
composite literal uses unkeyed fields
fundingmanager.go:380: no formatting directive in Errorf call
exit status 1
2017-02-22 14:58:37 -08:00
Olaoluwa Osuntokun
384fe61e73
multi: fix go vet warnings throughout code base 2017-02-16 19:33:19 +08:00
Andrey Samokhvalov
51d53eab32 test: fix typos 2017-01-12 16:43:55 -08:00
Olaoluwa Osuntokun
9ccf9947a2
test: add ability to push funds during funding to OpenChannel
This commit adds support for pushing funds during the funding process
to the helper method in the integration testing framework.

Additionally, we also modify the simple testBasicChannelFunding test to
also push over an amount in order to test the functionality within the
daemon.
2017-01-09 19:34:28 -08:00
Olaoluwa Osuntokun
5affed38fc
multi: update btcsuite API's to latest upstream changes
This commit makes a large number of minor changes concerning API usage
within the deamon to match the latest version on the upstream btcsuite
libraries.

The major changes are the switch from wire.ShaHash to chainhash.Hash,
and that wire.NewMsgTx() now takes a paramter indicating the version of
the transaction to be created.
2017-01-05 13:56:34 -08:00
Olaoluwa Osuntokun
ad76899a57
config+test: use default port for RPC server if one isn't specified
This commit alters the configuration parsing a bit along with the
documentation to expect the RPCHost configuration paramter to also have
the target port specified. If the port isn’t included, then the default
btcd RPC port for that chain is used.

Additionally, within the integration testing framework, when creating
the lnd nodes, we now use the configuration from the btcd harness to
set the proper RPC host.
2017-01-05 13:18:26 -08:00
bryanvu
aa04f82a15 utxonursery: added persistence to transaction output states
Moved transaction states from in-memory maps to persistent BoltDB
buckets. This allows channel force closes to operate reliably if the
daemon is shut down and restarted at any point during the forced
channel closure process.
2017-01-03 16:23:07 -08:00
Olaoluwa Osuntokun
5a678d5beb
test: add a callback to networkHarness.RestartNode
This commit adds a callback to the RestartNode method on the network
harness in order to allow test authors to execute arbitrary logic
in-between the restart process for the node.
2016-11-21 21:08:52 -06:00
Olaoluwa Osuntokun
c31c980f82
netharness: properly return all errors during lightningNode.start() 2016-11-16 12:44:43 -08:00
Olaoluwa Osuntokun
39c279b639
test: add ability to networkHarness to cause an arbitrary node to restart
This commit adds a new feature to the network harness: test writers are
now able to select arbitrary nodes, causing them to restart.

This functionality will be useful in the future in order to test
scenarios like persisting data across restarts, re-syncing after
re-connections, reacting to the counter party broadcasting revoked
states, etc.
2016-11-14 15:49:09 -08:00
Olaoluwa Osuntokun
474f0afceb
test: convert network harness RPC methods to use node pubkeys 2016-10-27 19:43:36 -07:00
Olaoluwa Osuntokun
a7b7f4f272
test: fix double close channel bug by removing wait in lightningNode.stop()
This commit fixes a panic bug caused by two calls to a process’
cmd.Wait() method. If two nodes incurred a fatal error as soon as they
were created, then both the goroutine detected to recovering the stderr
data and the defer statement would case a double channel close due to
the simultaneous calls to Wait().
2016-10-23 19:27:32 -07:00