itest: add etcd flag to control if new lnd nodes should run on etcd
This commit is contained in:
parent
511e817624
commit
98342433ab
@ -60,6 +60,10 @@ type NetworkHarness struct {
|
|||||||
Alice *HarnessNode
|
Alice *HarnessNode
|
||||||
Bob *HarnessNode
|
Bob *HarnessNode
|
||||||
|
|
||||||
|
// useEtcd is set to true if new nodes are to be created with an
|
||||||
|
// embedded etcd backend instead of just bbolt.
|
||||||
|
useEtcd bool
|
||||||
|
|
||||||
// Channel for transmitting stderr output from failed lightning node
|
// Channel for transmitting stderr output from failed lightning node
|
||||||
// to main process.
|
// to main process.
|
||||||
lndErrorChan chan error
|
lndErrorChan chan error
|
||||||
@ -77,8 +81,8 @@ type NetworkHarness struct {
|
|||||||
// TODO(roasbeef): add option to use golang's build library to a binary of the
|
// TODO(roasbeef): add option to use golang's build library to a binary of the
|
||||||
// current repo. This will save developers from having to manually `go install`
|
// current repo. This will save developers from having to manually `go install`
|
||||||
// within the repo each time before changes
|
// within the repo each time before changes
|
||||||
func NewNetworkHarness(r *rpctest.Harness, b BackendConfig, lndBinary string) (
|
func NewNetworkHarness(r *rpctest.Harness, b BackendConfig, lndBinary string,
|
||||||
*NetworkHarness, error) {
|
useEtcd bool) (*NetworkHarness, error) {
|
||||||
|
|
||||||
feeService := startFeeService()
|
feeService := startFeeService()
|
||||||
|
|
||||||
@ -92,6 +96,7 @@ func NewNetworkHarness(r *rpctest.Harness, b BackendConfig, lndBinary string) (
|
|||||||
feeService: feeService,
|
feeService: feeService,
|
||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
lndBinary: lndBinary,
|
lndBinary: lndBinary,
|
||||||
|
useEtcd: useEtcd,
|
||||||
}
|
}
|
||||||
return &n, nil
|
return &n, nil
|
||||||
}
|
}
|
||||||
@ -376,6 +381,7 @@ func (n *NetworkHarness) newNode(name string, extraArgs []string, hasSeed bool,
|
|||||||
NetParams: n.netParams,
|
NetParams: n.netParams,
|
||||||
ExtraArgs: extraArgs,
|
ExtraArgs: extraArgs,
|
||||||
FeeURL: n.feeService.url,
|
FeeURL: n.feeService.url,
|
||||||
|
Etcd: n.useEtcd,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -81,6 +81,9 @@ var (
|
|||||||
"runtranche", defaultRunTranche, "run the tranche of the "+
|
"runtranche", defaultRunTranche, "run the tranche of the "+
|
||||||
"split test cases with the given (0-based) index",
|
"split test cases with the given (0-based) index",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// useEtcd test LND nodes use (embedded) etcd as remote db.
|
||||||
|
useEtcd = flag.Bool("etcd", false, "Use etcd backend for lnd.")
|
||||||
)
|
)
|
||||||
|
|
||||||
// getTestCaseSplitTranche returns the sub slice of the test cases that should
|
// getTestCaseSplitTranche returns the sub slice of the test cases that should
|
||||||
@ -14250,7 +14253,9 @@ func TestLightningNetworkDaemon(t *testing.T) {
|
|||||||
// Now we can set up our test harness (LND instance), with the chain
|
// Now we can set up our test harness (LND instance), with the chain
|
||||||
// backend we just created.
|
// backend we just created.
|
||||||
binary := ht.getLndBinary()
|
binary := ht.getLndBinary()
|
||||||
lndHarness, err = lntest.NewNetworkHarness(miner, chainBackend, binary)
|
lndHarness, err = lntest.NewNetworkHarness(
|
||||||
|
miner, chainBackend, binary, *useEtcd,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ht.Fatalf("unable to create lightning network harness: %v", err)
|
ht.Fatalf("unable to create lightning network harness: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,8 @@ type NodeConfig struct {
|
|||||||
AcceptKeySend bool
|
AcceptKeySend bool
|
||||||
|
|
||||||
FeeURL string
|
FeeURL string
|
||||||
|
|
||||||
|
Etcd bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cfg NodeConfig) P2PAddr() string {
|
func (cfg NodeConfig) P2PAddr() string {
|
||||||
@ -261,6 +263,11 @@ func (cfg NodeConfig) genArgs() []string {
|
|||||||
args = append(args, "--accept-keysend")
|
args = append(args, "--accept-keysend")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.Etcd {
|
||||||
|
args = append(args, "--db.backend=etcd")
|
||||||
|
args = append(args, "--db.etcd.embedded")
|
||||||
|
}
|
||||||
|
|
||||||
if cfg.FeeURL != "" {
|
if cfg.FeeURL != "" {
|
||||||
args = append(args, "--feeurl="+cfg.FeeURL)
|
args = append(args, "--feeurl="+cfg.FeeURL)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user