channeldb: move makeTestDB out of test to make it available for other tests

This commit moves makeTestDB to db.go and exports it so that we'll be
able to use this function in other unit tests to make them testable with
etcd if needed.
This commit is contained in:
Andras Banki-Horvath
2020-06-24 12:50:11 +02:00
parent 63e9d6102f
commit cbce8e8872
13 changed files with 113 additions and 114 deletions

View File

@@ -56,7 +56,7 @@ func genInfo() (*PaymentCreationInfo, *HTLCAttemptInfo,
func TestPaymentControlSwitchFail(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
t.Fatalf("unable to init db: %v", err)
@@ -203,7 +203,7 @@ func TestPaymentControlSwitchFail(t *testing.T) {
func TestPaymentControlSwitchDoubleSend(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
@@ -286,7 +286,7 @@ func TestPaymentControlSwitchDoubleSend(t *testing.T) {
func TestPaymentControlSuccessesWithoutInFlight(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
@@ -319,7 +319,7 @@ func TestPaymentControlSuccessesWithoutInFlight(t *testing.T) {
func TestPaymentControlFailsWithoutInFlight(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
@@ -347,7 +347,7 @@ func TestPaymentControlFailsWithoutInFlight(t *testing.T) {
func TestPaymentControlDeleteNonInFligt(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
@@ -530,7 +530,7 @@ func TestPaymentControlMultiShard(t *testing.T) {
}
runSubTest := func(t *testing.T, test testCase) {
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {
@@ -780,7 +780,7 @@ func TestPaymentControlMultiShard(t *testing.T) {
func TestPaymentControlMPPRecordValidation(t *testing.T) {
t.Parallel()
db, cleanup, err := makeTestDB()
db, cleanup, err := MakeTestDB()
defer cleanup()
if err != nil {