routing+routerrpc: test stream cancellation

Test stream cancellation of the TrackPayments rpc call. In order to achieve
this, ControlTowerSubscriber is converted to an interface, to avoid trying to
close a null channel when closing the subscription. By returning a mock
implementation of the ControlTowerSubscriber in the test that problem is
avoided.
This commit is contained in:
Jesse de Wit
2022-09-05 13:20:38 +02:00
parent 4bc3007668
commit 0266ab77ab
5 changed files with 131 additions and 70 deletions

View File

@@ -552,13 +552,13 @@ func (m *mockControlTowerOld) FetchInFlightPayments() (
}
func (m *mockControlTowerOld) SubscribePayment(paymentHash lntypes.Hash) (
*ControlTowerSubscriber, error) {
ControlTowerSubscriber, error) {
return nil, errors.New("not implemented")
}
func (m *mockControlTowerOld) SubscribeAllPayments() (
*ControlTowerSubscriber, error) {
ControlTowerSubscriber, error) {
return nil, errors.New("not implemented")
}
@@ -774,17 +774,17 @@ func (m *mockControlTower) FetchInFlightPayments() (
}
func (m *mockControlTower) SubscribePayment(paymentHash lntypes.Hash) (
*ControlTowerSubscriber, error) {
ControlTowerSubscriber, error) {
args := m.Called(paymentHash)
return args.Get(0).(*ControlTowerSubscriber), args.Error(1)
return args.Get(0).(ControlTowerSubscriber), args.Error(1)
}
func (m *mockControlTower) SubscribeAllPayments() (
*ControlTowerSubscriber, error) {
ControlTowerSubscriber, error) {
args := m.Called()
return args.Get(0).(*ControlTowerSubscriber), args.Error(1)
return args.Get(0).(ControlTowerSubscriber), args.Error(1)
}
type mockLink struct {