channeldb: fix payment control unit tests w/ errors.Is
This commit is contained in:
1 parent
648fb22f63
commit
0609431a0c
1 file changed
+4
-6
@@ -181,7 +181,7 @@ func TestPaymentControlSwitchFail(t *testing.T) {
|
|||||||
// Attempt a final payment, which should now fail since the prior
|
// Attempt a final payment, which should now fail since the prior
|
||||||
// payment succeed.
|
// payment succeed.
|
||||||
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
||||||
if err != ErrAlreadyPaid {
|
if !errors.Is(err, ErrAlreadyPaid) {
|
||||||
t.Fatalf("unable to send htlc message: %v", err)
|
t.Fatalf("unable to send htlc message: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,9 +216,7 @@ func TestPaymentControlSwitchDoubleSend(t *testing.T) {
|
|||||||
// payment hash, should result in error indicating that payment has
|
// payment hash, should result in error indicating that payment has
|
||||||
// already been sent.
|
// already been sent.
|
||||||
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
||||||
require.Equal(t, ErrPaymentExists, err, "payment control wrong "+
|
require.ErrorIs(t, err, ErrPaymentExists)
|
||||||
"behaviour: init payment again must trigger ErrPaymentExists "+
|
|
||||||
"error")
|
|
||||||
|
|
||||||
// Record an attempt.
|
// Record an attempt.
|
||||||
_, err = pControl.RegisterAttempt(info.PaymentIdentifier, attempt)
|
_, err = pControl.RegisterAttempt(info.PaymentIdentifier, attempt)
|
||||||
@@ -234,7 +232,7 @@ func TestPaymentControlSwitchDoubleSend(t *testing.T) {
|
|||||||
|
|
||||||
// Sends base htlc message which initiate StatusInFlight.
|
// Sends base htlc message which initiate StatusInFlight.
|
||||||
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
||||||
if err != ErrPaymentInFlight {
|
if !errors.Is(err, ErrPaymentInFlight) {
|
||||||
t.Fatalf("payment control wrong behaviour: " +
|
t.Fatalf("payment control wrong behaviour: " +
|
||||||
"double sending must trigger ErrPaymentInFlight error")
|
"double sending must trigger ErrPaymentInFlight error")
|
||||||
}
|
}
|
||||||
@@ -253,7 +251,7 @@ func TestPaymentControlSwitchDoubleSend(t *testing.T) {
|
|||||||
assertPaymentInfo(t, pControl, info.PaymentIdentifier, info, nil, htlc)
|
assertPaymentInfo(t, pControl, info.PaymentIdentifier, info, nil, htlc)
|
||||||
|
|
||||||
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
err = pControl.InitPayment(info.PaymentIdentifier, info)
|
||||||
if err != ErrAlreadyPaid {
|
if !errors.Is(err, ErrAlreadyPaid) {
|
||||||
t.Fatalf("unable to send htlc message: %v", err)
|
t.Fatalf("unable to send htlc message: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user