9992e5c0b5
This refactor changes how we instantiate the etcd based Backend to allow separate initialization and startup for the embedded instance.
22 lines
567 B
Go
22 lines
567 B
Go
// +build kvdb_etcd
|
|
|
|
package kvdb
|
|
|
|
import (
|
|
"github.com/lightningnetwork/lnd/channeldb/kvdb/etcd"
|
|
)
|
|
|
|
// TestBackend is conditionally set to etcd when the kvdb_etcd build tag is
|
|
// defined, allowing testing our database code with etcd backend.
|
|
const TestBackend = EtcdBackendName
|
|
|
|
// GetEtcdTestBackend creates an embedded etcd backend for testing
|
|
// storig the database at the passed path.
|
|
func StartEtcdTestBackend(path string, clientPort, peerPort uint16) (
|
|
*etcd.Config, func(), error) {
|
|
|
|
return etcd.NewEmbeddedEtcdInstance(
|
|
path, clientPort, peerPort,
|
|
)
|
|
}
|