consul/grpcmocks/proto-public/pbresource/mock_isWatchEvent_Event.go

65 lines
2.0 KiB
Go
Raw Normal View History

v2: ensure the controller caches are fully populated before first use (#20421) The new controller caches are initialized before the DependencyMappers or the Reconciler run, but importantly they are not populated. The expectation is that when the WatchList call is made to the resource service it will send an initial snapshot of all resources matching a single type, and then perpetually send UPSERT/DELETE events afterward. This initial snapshot will cycle through the caching layer and will catch it up to reflect the stored data. Critically the dependency mappers and reconcilers will race against the restoration of the caches on server startup or leader election. During this time it is possible a mapper or reconciler will use the cache to lookup a specific relationship and not find it. That very same reconciler may choose to then recompute some persisted resource and in effect rewind it to a prior computed state. Change - Since we are updating the behavior of the WatchList RPC, it was aligned to match that of pbsubscribe and pbpeerstream using a protobuf oneof instead of the enum+fields option. - The WatchList rpc now has 3 alternating response events: Upsert, Delete, EndOfSnapshot. When set the initial batch of "snapshot" Upserts sent on a new watch, those operations will be followed by an EndOfSnapshot event before beginning the never-ending sequence of Upsert/Delete events. - Within the Controller startup code we will launch N+1 goroutines to execute WatchList queries for the watched types. The UPSERTs will be applied to the nascent cache only (no mappers will execute). - Upon witnessing the END operation, those goroutines will terminate. - When all cache priming routines complete, then the normal set of N+1 long lived watch routines will launch to officially witness all events in the system using the primed cached.
2024-02-02 21:11:05 +00:00
// Code generated by mockery v2.37.1. DO NOT EDIT.
package mockpbresource
import mock "github.com/stretchr/testify/mock"
// isWatchEvent_Event is an autogenerated mock type for the isWatchEvent_Event type
type isWatchEvent_Event struct {
mock.Mock
}
type isWatchEvent_Event_Expecter struct {
mock *mock.Mock
}
func (_m *isWatchEvent_Event) EXPECT() *isWatchEvent_Event_Expecter {
return &isWatchEvent_Event_Expecter{mock: &_m.Mock}
}
// isWatchEvent_Event provides a mock function with given fields:
func (_m *isWatchEvent_Event) isWatchEvent_Event() {
_m.Called()
}
// isWatchEvent_Event_isWatchEvent_Event_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'isWatchEvent_Event'
type isWatchEvent_Event_isWatchEvent_Event_Call struct {
*mock.Call
}
// isWatchEvent_Event is a helper method to define mock.On call
func (_e *isWatchEvent_Event_Expecter) isWatchEvent_Event() *isWatchEvent_Event_isWatchEvent_Event_Call {
return &isWatchEvent_Event_isWatchEvent_Event_Call{Call: _e.mock.On("isWatchEvent_Event")}
}
func (_c *isWatchEvent_Event_isWatchEvent_Event_Call) Run(run func()) *isWatchEvent_Event_isWatchEvent_Event_Call {
_c.Call.Run(func(args mock.Arguments) {
run()
})
return _c
}
func (_c *isWatchEvent_Event_isWatchEvent_Event_Call) Return() *isWatchEvent_Event_isWatchEvent_Event_Call {
_c.Call.Return()
return _c
}
func (_c *isWatchEvent_Event_isWatchEvent_Event_Call) RunAndReturn(run func()) *isWatchEvent_Event_isWatchEvent_Event_Call {
_c.Call.Return(run)
return _c
}
// newIsWatchEvent_Event creates a new instance of isWatchEvent_Event. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func newIsWatchEvent_Event(t interface {
mock.TestingT
Cleanup(func())
}) *isWatchEvent_Event {
mock := &isWatchEvent_Event{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}