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