2020-05-15 16:59:37 +02:00
|
|
|
// +build kvdb_etcd
|
|
|
|
|
|
|
|
package kvdb
|
|
|
|
|
|
|
|
import (
|
2021-04-26 19:08:11 +02:00
|
|
|
"github.com/lightningnetwork/lnd/kvdb/etcd"
|
2020-05-15 16:59:37 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// 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.
|
2021-02-09 17:44:43 +01:00
|
|
|
func StartEtcdTestBackend(path string, clientPort, peerPort uint16) (
|
|
|
|
*etcd.Config, func(), error) {
|
2021-01-06 19:40:30 +01:00
|
|
|
|
2021-02-09 17:44:43 +01:00
|
|
|
return etcd.NewEmbeddedEtcdInstance(
|
2021-01-06 19:40:30 +01:00
|
|
|
path, clientPort, peerPort,
|
|
|
|
)
|
2020-05-15 16:59:37 +02:00
|
|
|
}
|