github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/network/p2p/mock/lib_p2_p_node.go (about)

     1  // Code generated by mockery v2.21.4. DO NOT EDIT.
     2  
     3  package mockp2p
     4  
     5  import (
     6  	component "github.com/onflow/flow-go/module/component"
     7  	channels "github.com/onflow/flow-go/network/channels"
     8  
     9  	context "context"
    10  
    11  	corenetwork "github.com/libp2p/go-libp2p/core/network"
    12  
    13  	flow "github.com/onflow/flow-go/model/flow"
    14  
    15  	host "github.com/libp2p/go-libp2p/core/host"
    16  
    17  	irrecoverable "github.com/onflow/flow-go/module/irrecoverable"
    18  
    19  	kbucket "github.com/libp2p/go-libp2p-kbucket"
    20  
    21  	mock "github.com/stretchr/testify/mock"
    22  
    23  	network "github.com/onflow/flow-go/network"
    24  
    25  	p2p "github.com/onflow/flow-go/network/p2p"
    26  
    27  	peer "github.com/libp2p/go-libp2p/core/peer"
    28  
    29  	protocol "github.com/libp2p/go-libp2p/core/protocol"
    30  
    31  	protocols "github.com/onflow/flow-go/network/p2p/unicast/protocols"
    32  
    33  	routing "github.com/libp2p/go-libp2p/core/routing"
    34  )
    35  
    36  // LibP2PNode is an autogenerated mock type for the LibP2PNode type
    37  type LibP2PNode struct {
    38  	mock.Mock
    39  }
    40  
    41  // ActiveClustersChanged provides a mock function with given fields: _a0
    42  func (_m *LibP2PNode) ActiveClustersChanged(_a0 flow.ChainIDList) {
    43  	_m.Called(_a0)
    44  }
    45  
    46  // ConnectToPeer provides a mock function with given fields: ctx, peerInfo
    47  func (_m *LibP2PNode) ConnectToPeer(ctx context.Context, peerInfo peer.AddrInfo) error {
    48  	ret := _m.Called(ctx, peerInfo)
    49  
    50  	var r0 error
    51  	if rf, ok := ret.Get(0).(func(context.Context, peer.AddrInfo) error); ok {
    52  		r0 = rf(ctx, peerInfo)
    53  	} else {
    54  		r0 = ret.Error(0)
    55  	}
    56  
    57  	return r0
    58  }
    59  
    60  // Done provides a mock function with given fields:
    61  func (_m *LibP2PNode) Done() <-chan struct{} {
    62  	ret := _m.Called()
    63  
    64  	var r0 <-chan struct{}
    65  	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
    66  		r0 = rf()
    67  	} else {
    68  		if ret.Get(0) != nil {
    69  			r0 = ret.Get(0).(<-chan struct{})
    70  		}
    71  	}
    72  
    73  	return r0
    74  }
    75  
    76  // GetIPPort provides a mock function with given fields:
    77  func (_m *LibP2PNode) GetIPPort() (string, string, error) {
    78  	ret := _m.Called()
    79  
    80  	var r0 string
    81  	var r1 string
    82  	var r2 error
    83  	if rf, ok := ret.Get(0).(func() (string, string, error)); ok {
    84  		return rf()
    85  	}
    86  	if rf, ok := ret.Get(0).(func() string); ok {
    87  		r0 = rf()
    88  	} else {
    89  		r0 = ret.Get(0).(string)
    90  	}
    91  
    92  	if rf, ok := ret.Get(1).(func() string); ok {
    93  		r1 = rf()
    94  	} else {
    95  		r1 = ret.Get(1).(string)
    96  	}
    97  
    98  	if rf, ok := ret.Get(2).(func() error); ok {
    99  		r2 = rf()
   100  	} else {
   101  		r2 = ret.Error(2)
   102  	}
   103  
   104  	return r0, r1, r2
   105  }
   106  
   107  // GetLocalMeshPeers provides a mock function with given fields: topic
   108  func (_m *LibP2PNode) GetLocalMeshPeers(topic channels.Topic) []peer.ID {
   109  	ret := _m.Called(topic)
   110  
   111  	var r0 []peer.ID
   112  	if rf, ok := ret.Get(0).(func(channels.Topic) []peer.ID); ok {
   113  		r0 = rf(topic)
   114  	} else {
   115  		if ret.Get(0) != nil {
   116  			r0 = ret.Get(0).([]peer.ID)
   117  		}
   118  	}
   119  
   120  	return r0
   121  }
   122  
   123  // GetPeersForProtocol provides a mock function with given fields: pid
   124  func (_m *LibP2PNode) GetPeersForProtocol(pid protocol.ID) peer.IDSlice {
   125  	ret := _m.Called(pid)
   126  
   127  	var r0 peer.IDSlice
   128  	if rf, ok := ret.Get(0).(func(protocol.ID) peer.IDSlice); ok {
   129  		r0 = rf(pid)
   130  	} else {
   131  		if ret.Get(0) != nil {
   132  			r0 = ret.Get(0).(peer.IDSlice)
   133  		}
   134  	}
   135  
   136  	return r0
   137  }
   138  
   139  // HasSubscription provides a mock function with given fields: topic
   140  func (_m *LibP2PNode) HasSubscription(topic channels.Topic) bool {
   141  	ret := _m.Called(topic)
   142  
   143  	var r0 bool
   144  	if rf, ok := ret.Get(0).(func(channels.Topic) bool); ok {
   145  		r0 = rf(topic)
   146  	} else {
   147  		r0 = ret.Get(0).(bool)
   148  	}
   149  
   150  	return r0
   151  }
   152  
   153  // Host provides a mock function with given fields:
   154  func (_m *LibP2PNode) Host() host.Host {
   155  	ret := _m.Called()
   156  
   157  	var r0 host.Host
   158  	if rf, ok := ret.Get(0).(func() host.Host); ok {
   159  		r0 = rf()
   160  	} else {
   161  		if ret.Get(0) != nil {
   162  			r0 = ret.Get(0).(host.Host)
   163  		}
   164  	}
   165  
   166  	return r0
   167  }
   168  
   169  // ID provides a mock function with given fields:
   170  func (_m *LibP2PNode) ID() peer.ID {
   171  	ret := _m.Called()
   172  
   173  	var r0 peer.ID
   174  	if rf, ok := ret.Get(0).(func() peer.ID); ok {
   175  		r0 = rf()
   176  	} else {
   177  		r0 = ret.Get(0).(peer.ID)
   178  	}
   179  
   180  	return r0
   181  }
   182  
   183  // IsConnected provides a mock function with given fields: peerID
   184  func (_m *LibP2PNode) IsConnected(peerID peer.ID) (bool, error) {
   185  	ret := _m.Called(peerID)
   186  
   187  	var r0 bool
   188  	var r1 error
   189  	if rf, ok := ret.Get(0).(func(peer.ID) (bool, error)); ok {
   190  		return rf(peerID)
   191  	}
   192  	if rf, ok := ret.Get(0).(func(peer.ID) bool); ok {
   193  		r0 = rf(peerID)
   194  	} else {
   195  		r0 = ret.Get(0).(bool)
   196  	}
   197  
   198  	if rf, ok := ret.Get(1).(func(peer.ID) error); ok {
   199  		r1 = rf(peerID)
   200  	} else {
   201  		r1 = ret.Error(1)
   202  	}
   203  
   204  	return r0, r1
   205  }
   206  
   207  // IsDisallowListed provides a mock function with given fields: peerId
   208  func (_m *LibP2PNode) IsDisallowListed(peerId peer.ID) ([]network.DisallowListedCause, bool) {
   209  	ret := _m.Called(peerId)
   210  
   211  	var r0 []network.DisallowListedCause
   212  	var r1 bool
   213  	if rf, ok := ret.Get(0).(func(peer.ID) ([]network.DisallowListedCause, bool)); ok {
   214  		return rf(peerId)
   215  	}
   216  	if rf, ok := ret.Get(0).(func(peer.ID) []network.DisallowListedCause); ok {
   217  		r0 = rf(peerId)
   218  	} else {
   219  		if ret.Get(0) != nil {
   220  			r0 = ret.Get(0).([]network.DisallowListedCause)
   221  		}
   222  	}
   223  
   224  	if rf, ok := ret.Get(1).(func(peer.ID) bool); ok {
   225  		r1 = rf(peerId)
   226  	} else {
   227  		r1 = ret.Get(1).(bool)
   228  	}
   229  
   230  	return r0, r1
   231  }
   232  
   233  // ListPeers provides a mock function with given fields: topic
   234  func (_m *LibP2PNode) ListPeers(topic string) []peer.ID {
   235  	ret := _m.Called(topic)
   236  
   237  	var r0 []peer.ID
   238  	if rf, ok := ret.Get(0).(func(string) []peer.ID); ok {
   239  		r0 = rf(topic)
   240  	} else {
   241  		if ret.Get(0) != nil {
   242  			r0 = ret.Get(0).([]peer.ID)
   243  		}
   244  	}
   245  
   246  	return r0
   247  }
   248  
   249  // OnAllowListNotification provides a mock function with given fields: id, cause
   250  func (_m *LibP2PNode) OnAllowListNotification(id peer.ID, cause network.DisallowListedCause) {
   251  	_m.Called(id, cause)
   252  }
   253  
   254  // OnDisallowListNotification provides a mock function with given fields: id, cause
   255  func (_m *LibP2PNode) OnDisallowListNotification(id peer.ID, cause network.DisallowListedCause) {
   256  	_m.Called(id, cause)
   257  }
   258  
   259  // OpenAndWriteOnStream provides a mock function with given fields: ctx, peerID, protectionTag, writingLogic
   260  func (_m *LibP2PNode) OpenAndWriteOnStream(ctx context.Context, peerID peer.ID, protectionTag string, writingLogic func(corenetwork.Stream) error) error {
   261  	ret := _m.Called(ctx, peerID, protectionTag, writingLogic)
   262  
   263  	var r0 error
   264  	if rf, ok := ret.Get(0).(func(context.Context, peer.ID, string, func(corenetwork.Stream) error) error); ok {
   265  		r0 = rf(ctx, peerID, protectionTag, writingLogic)
   266  	} else {
   267  		r0 = ret.Error(0)
   268  	}
   269  
   270  	return r0
   271  }
   272  
   273  // PeerManagerComponent provides a mock function with given fields:
   274  func (_m *LibP2PNode) PeerManagerComponent() component.Component {
   275  	ret := _m.Called()
   276  
   277  	var r0 component.Component
   278  	if rf, ok := ret.Get(0).(func() component.Component); ok {
   279  		r0 = rf()
   280  	} else {
   281  		if ret.Get(0) != nil {
   282  			r0 = ret.Get(0).(component.Component)
   283  		}
   284  	}
   285  
   286  	return r0
   287  }
   288  
   289  // PeerScoreExposer provides a mock function with given fields:
   290  func (_m *LibP2PNode) PeerScoreExposer() p2p.PeerScoreExposer {
   291  	ret := _m.Called()
   292  
   293  	var r0 p2p.PeerScoreExposer
   294  	if rf, ok := ret.Get(0).(func() p2p.PeerScoreExposer); ok {
   295  		r0 = rf()
   296  	} else {
   297  		if ret.Get(0) != nil {
   298  			r0 = ret.Get(0).(p2p.PeerScoreExposer)
   299  		}
   300  	}
   301  
   302  	return r0
   303  }
   304  
   305  // Publish provides a mock function with given fields: ctx, messageScope
   306  func (_m *LibP2PNode) Publish(ctx context.Context, messageScope network.OutgoingMessageScope) error {
   307  	ret := _m.Called(ctx, messageScope)
   308  
   309  	var r0 error
   310  	if rf, ok := ret.Get(0).(func(context.Context, network.OutgoingMessageScope) error); ok {
   311  		r0 = rf(ctx, messageScope)
   312  	} else {
   313  		r0 = ret.Error(0)
   314  	}
   315  
   316  	return r0
   317  }
   318  
   319  // Ready provides a mock function with given fields:
   320  func (_m *LibP2PNode) Ready() <-chan struct{} {
   321  	ret := _m.Called()
   322  
   323  	var r0 <-chan struct{}
   324  	if rf, ok := ret.Get(0).(func() <-chan struct{}); ok {
   325  		r0 = rf()
   326  	} else {
   327  		if ret.Get(0) != nil {
   328  			r0 = ret.Get(0).(<-chan struct{})
   329  		}
   330  	}
   331  
   332  	return r0
   333  }
   334  
   335  // RemovePeer provides a mock function with given fields: peerID
   336  func (_m *LibP2PNode) RemovePeer(peerID peer.ID) error {
   337  	ret := _m.Called(peerID)
   338  
   339  	var r0 error
   340  	if rf, ok := ret.Get(0).(func(peer.ID) error); ok {
   341  		r0 = rf(peerID)
   342  	} else {
   343  		r0 = ret.Error(0)
   344  	}
   345  
   346  	return r0
   347  }
   348  
   349  // RequestPeerUpdate provides a mock function with given fields:
   350  func (_m *LibP2PNode) RequestPeerUpdate() {
   351  	_m.Called()
   352  }
   353  
   354  // Routing provides a mock function with given fields:
   355  func (_m *LibP2PNode) Routing() routing.Routing {
   356  	ret := _m.Called()
   357  
   358  	var r0 routing.Routing
   359  	if rf, ok := ret.Get(0).(func() routing.Routing); ok {
   360  		r0 = rf()
   361  	} else {
   362  		if ret.Get(0) != nil {
   363  			r0 = ret.Get(0).(routing.Routing)
   364  		}
   365  	}
   366  
   367  	return r0
   368  }
   369  
   370  // RoutingTable provides a mock function with given fields:
   371  func (_m *LibP2PNode) RoutingTable() *kbucket.RoutingTable {
   372  	ret := _m.Called()
   373  
   374  	var r0 *kbucket.RoutingTable
   375  	if rf, ok := ret.Get(0).(func() *kbucket.RoutingTable); ok {
   376  		r0 = rf()
   377  	} else {
   378  		if ret.Get(0) != nil {
   379  			r0 = ret.Get(0).(*kbucket.RoutingTable)
   380  		}
   381  	}
   382  
   383  	return r0
   384  }
   385  
   386  // SetComponentManager provides a mock function with given fields: cm
   387  func (_m *LibP2PNode) SetComponentManager(cm *component.ComponentManager) {
   388  	_m.Called(cm)
   389  }
   390  
   391  // SetPubSub provides a mock function with given fields: ps
   392  func (_m *LibP2PNode) SetPubSub(ps p2p.PubSubAdapter) {
   393  	_m.Called(ps)
   394  }
   395  
   396  // SetRouting provides a mock function with given fields: r
   397  func (_m *LibP2PNode) SetRouting(r routing.Routing) error {
   398  	ret := _m.Called(r)
   399  
   400  	var r0 error
   401  	if rf, ok := ret.Get(0).(func(routing.Routing) error); ok {
   402  		r0 = rf(r)
   403  	} else {
   404  		r0 = ret.Error(0)
   405  	}
   406  
   407  	return r0
   408  }
   409  
   410  // SetUnicastManager provides a mock function with given fields: uniMgr
   411  func (_m *LibP2PNode) SetUnicastManager(uniMgr p2p.UnicastManager) {
   412  	_m.Called(uniMgr)
   413  }
   414  
   415  // Start provides a mock function with given fields: ctx
   416  func (_m *LibP2PNode) Start(ctx irrecoverable.SignalerContext) {
   417  	_m.Called(ctx)
   418  }
   419  
   420  // Stop provides a mock function with given fields:
   421  func (_m *LibP2PNode) Stop() error {
   422  	ret := _m.Called()
   423  
   424  	var r0 error
   425  	if rf, ok := ret.Get(0).(func() error); ok {
   426  		r0 = rf()
   427  	} else {
   428  		r0 = ret.Error(0)
   429  	}
   430  
   431  	return r0
   432  }
   433  
   434  // Subscribe provides a mock function with given fields: topic, topicValidator
   435  func (_m *LibP2PNode) Subscribe(topic channels.Topic, topicValidator p2p.TopicValidatorFunc) (p2p.Subscription, error) {
   436  	ret := _m.Called(topic, topicValidator)
   437  
   438  	var r0 p2p.Subscription
   439  	var r1 error
   440  	if rf, ok := ret.Get(0).(func(channels.Topic, p2p.TopicValidatorFunc) (p2p.Subscription, error)); ok {
   441  		return rf(topic, topicValidator)
   442  	}
   443  	if rf, ok := ret.Get(0).(func(channels.Topic, p2p.TopicValidatorFunc) p2p.Subscription); ok {
   444  		r0 = rf(topic, topicValidator)
   445  	} else {
   446  		if ret.Get(0) != nil {
   447  			r0 = ret.Get(0).(p2p.Subscription)
   448  		}
   449  	}
   450  
   451  	if rf, ok := ret.Get(1).(func(channels.Topic, p2p.TopicValidatorFunc) error); ok {
   452  		r1 = rf(topic, topicValidator)
   453  	} else {
   454  		r1 = ret.Error(1)
   455  	}
   456  
   457  	return r0, r1
   458  }
   459  
   460  // Unsubscribe provides a mock function with given fields: topic
   461  func (_m *LibP2PNode) Unsubscribe(topic channels.Topic) error {
   462  	ret := _m.Called(topic)
   463  
   464  	var r0 error
   465  	if rf, ok := ret.Get(0).(func(channels.Topic) error); ok {
   466  		r0 = rf(topic)
   467  	} else {
   468  		r0 = ret.Error(0)
   469  	}
   470  
   471  	return r0
   472  }
   473  
   474  // WithDefaultUnicastProtocol provides a mock function with given fields: defaultHandler, preferred
   475  func (_m *LibP2PNode) WithDefaultUnicastProtocol(defaultHandler corenetwork.StreamHandler, preferred []protocols.ProtocolName) error {
   476  	ret := _m.Called(defaultHandler, preferred)
   477  
   478  	var r0 error
   479  	if rf, ok := ret.Get(0).(func(corenetwork.StreamHandler, []protocols.ProtocolName) error); ok {
   480  		r0 = rf(defaultHandler, preferred)
   481  	} else {
   482  		r0 = ret.Error(0)
   483  	}
   484  
   485  	return r0
   486  }
   487  
   488  // WithPeersProvider provides a mock function with given fields: peersProvider
   489  func (_m *LibP2PNode) WithPeersProvider(peersProvider p2p.PeersProvider) {
   490  	_m.Called(peersProvider)
   491  }
   492  
   493  type mockConstructorTestingTNewLibP2PNode interface {
   494  	mock.TestingT
   495  	Cleanup(func())
   496  }
   497  
   498  // NewLibP2PNode creates a new instance of LibP2PNode. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
   499  func NewLibP2PNode(t mockConstructorTestingTNewLibP2PNode) *LibP2PNode {
   500  	mock := &LibP2PNode{}
   501  	mock.Mock.Test(t)
   502  
   503  	t.Cleanup(func() { mock.AssertExpectations(t) })
   504  
   505  	return mock
   506  }