Documentation
¶
Index ¶
- type EventSourceMock
- func (e *EventSourceMock) Cleanup() error
- func (e *EventSourceMock) OnSubscriptionUpdate(subscriptions []models.EventSubscription)
- func (e *EventSourceMock) Sender() types.EventSender
- func (e *EventSourceMock) Start(ctx context.Context, data types.RegistrationData, ...) error
- func (e *EventSourceMock) Stop() error
- type LogAPIMock
- func (mock *LogAPIMock) DeleteLogs(filter models.LogFilter) error
- func (mock *LogAPIMock) DeleteLogsCalls() []struct{ ... }
- func (mock *LogAPIMock) Flush() error
- func (mock *LogAPIMock) FlushCalls() []struct{}
- func (mock *LogAPIMock) GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)
- func (mock *LogAPIMock) GetLogsCalls() []struct{ ... }
- func (mock *LogAPIMock) Log(logs []models.LogEntry)
- func (mock *LogAPIMock) LogCalls() []struct{ ... }
- func (mock *LogAPIMock) Start(ctx context.Context)
- func (mock *LogAPIMock) StartCalls() []struct{ ... }
- type ShipyardEventAPIMock
- type SubscriptionSourceMock
- type UniformAPIMock
- func (m *UniformAPIMock) CreateSubscription(integrationID string, subscription models.EventSubscription) (string, error)
- func (m *UniformAPIMock) GetRegistrations() ([]*models.Integration, error)
- func (m *UniformAPIMock) Ping(integrationID string) (*models.Integration, error)
- func (m *UniformAPIMock) RegisterIntegration(integration models.Integration) (string, error)
- func (m *UniformAPIMock) UnregisterIntegration(integrationID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventSourceMock ¶
type EventSourceMock struct {
StartFn func(context.Context, types.RegistrationData, chan types.EventUpdate, chan error, *sync.WaitGroup) error
OnSubscriptionUpdateFn func([]models.EventSubscription)
SenderFn func() types.EventSender
StopFn func() error
CleanupFn func() error
}
func (*EventSourceMock) Cleanup ¶ added in v0.18.0
func (e *EventSourceMock) Cleanup() error
func (*EventSourceMock) OnSubscriptionUpdate ¶
func (e *EventSourceMock) OnSubscriptionUpdate(subscriptions []models.EventSubscription)
func (*EventSourceMock) Sender ¶
func (e *EventSourceMock) Sender() types.EventSender
func (*EventSourceMock) Start ¶
func (e *EventSourceMock) Start(ctx context.Context, data types.RegistrationData, eventC chan types.EventUpdate, errC chan error, wg *sync.WaitGroup) error
func (*EventSourceMock) Stop ¶
func (e *EventSourceMock) Stop() error
type LogAPIMock ¶
type LogAPIMock struct {
// DeleteLogsFunc mocks the DeleteLogs method.
DeleteLogsFunc func(filter models.LogFilter) error
// FlushFunc mocks the Flush method.
FlushFunc func() error
// GetLogsFunc mocks the GetLogs method.
GetLogsFunc func(params models.GetLogsParams) (*models.GetLogsResponse, error)
// LogFunc mocks the Log method.
LogFunc func(logs []models.LogEntry)
// StartFunc mocks the Start method.
StartFunc func(ctx context.Context)
// contains filtered or unexported fields
}
LogAPIMock is a mock implementation of controlplane.logAPI.
func TestSomethingThatUseslogAPI(t *testing.T) {
// make and configure a mocked controlplane.logAPI
mockedlogAPI := &LogAPIMock{
DeleteLogsFunc: func(filter models.LogFilter) error {
panic("mock out the DeleteLogs method")
},
FlushFunc: func() error {
panic("mock out the Flush method")
},
GetLogsFunc: func(params models.GetLogsParams) (*models.GetLogsResponse, error) {
panic("mock out the GetLogs method")
},
LogFunc: func(logs []models.LogEntry) {
panic("mock out the Log method")
},
StartFunc: func(ctx context.Context) {
panic("mock out the Start method")
},
}
// use mockedlogAPI in code that requires controlplane.logAPI
// and then make assertions.
}
func (*LogAPIMock) DeleteLogs ¶
func (mock *LogAPIMock) DeleteLogs(filter models.LogFilter) error
DeleteLogs calls DeleteLogsFunc.
func (*LogAPIMock) DeleteLogsCalls ¶
func (mock *LogAPIMock) DeleteLogsCalls() []struct { Filter models.LogFilter }
DeleteLogsCalls gets all the calls that were made to DeleteLogs. Check the length with:
len(mockedlogAPI.DeleteLogsCalls())
func (*LogAPIMock) FlushCalls ¶
func (mock *LogAPIMock) FlushCalls() []struct { }
FlushCalls gets all the calls that were made to Flush. Check the length with:
len(mockedlogAPI.FlushCalls())
func (*LogAPIMock) GetLogs ¶
func (mock *LogAPIMock) GetLogs(params models.GetLogsParams) (*models.GetLogsResponse, error)
GetLogs calls GetLogsFunc.
func (*LogAPIMock) GetLogsCalls ¶
func (mock *LogAPIMock) GetLogsCalls() []struct { Params models.GetLogsParams }
GetLogsCalls gets all the calls that were made to GetLogs. Check the length with:
len(mockedlogAPI.GetLogsCalls())
func (*LogAPIMock) LogCalls ¶
func (mock *LogAPIMock) LogCalls() []struct { Logs []models.LogEntry }
LogCalls gets all the calls that were made to Log. Check the length with:
len(mockedlogAPI.LogCalls())
func (*LogAPIMock) Start ¶
func (mock *LogAPIMock) Start(ctx context.Context)
Start calls StartFunc.
func (*LogAPIMock) StartCalls ¶
func (mock *LogAPIMock) StartCalls() []struct { Ctx context.Context }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedlogAPI.StartCalls())
type ShipyardEventAPIMock ¶
type ShipyardEventAPIMock struct {
// GetOpenTriggeredEventsFunc mocks the GetOpenTriggeredEvents method.
GetOpenTriggeredEventsFunc func(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)
// contains filtered or unexported fields
}
ShipyardEventAPIMock is a mock implementation of httpeventsource.shipyardEventAPI.
func TestSomethingThatUsesshipyardEventAPI(t *testing.T) {
// make and configure a mocked httpeventsource.shipyardEventAPI
mockedshipyardEventAPI := &ShipyardEventAPIMock{
GetOpenTriggeredEventsFunc: func(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error) {
panic("mock out the GetOpenTriggeredEvents method")
},
}
// use mockedshipyardEventAPI in code that requires httpeventsource.shipyardEventAPI
// and then make assertions.
}
func (*ShipyardEventAPIMock) GetOpenTriggeredEvents ¶
func (mock *ShipyardEventAPIMock) GetOpenTriggeredEvents(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)
GetOpenTriggeredEvents calls GetOpenTriggeredEventsFunc.
func (*ShipyardEventAPIMock) GetOpenTriggeredEventsCalls ¶
func (mock *ShipyardEventAPIMock) GetOpenTriggeredEventsCalls() []struct { Filter api.EventFilter }
GetOpenTriggeredEventsCalls gets all the calls that were made to GetOpenTriggeredEvents. Check the length with:
len(mockedshipyardEventAPI.GetOpenTriggeredEventsCalls())
type SubscriptionSourceMock ¶
type SubscriptionSourceMock struct {
StartFn func(context.Context, types.RegistrationData, chan []models.EventSubscription, chan error, *sync.WaitGroup) error
RegisterFn func(integration models.Integration) (string, error)
StopFn func() error
}
func (*SubscriptionSourceMock) Register ¶
func (u *SubscriptionSourceMock) Register(integration models.Integration) (string, error)
func (*SubscriptionSourceMock) Start ¶
func (u *SubscriptionSourceMock) Start(ctx context.Context, data types.RegistrationData, c chan []models.EventSubscription, errC chan error, wg *sync.WaitGroup) error
func (*SubscriptionSourceMock) Stop ¶
func (u *SubscriptionSourceMock) Stop() error
type UniformAPIMock ¶
type UniformAPIMock struct {
RegisterIntegrationFn func(models.Integration) (string, error)
PingFn func(string) (*models.Integration, error)
}
func (*UniformAPIMock) CreateSubscription ¶
func (m *UniformAPIMock) CreateSubscription(integrationID string, subscription models.EventSubscription) (string, error)
func (*UniformAPIMock) GetRegistrations ¶
func (m *UniformAPIMock) GetRegistrations() ([]*models.Integration, error)
func (*UniformAPIMock) Ping ¶
func (m *UniformAPIMock) Ping(integrationID string) (*models.Integration, error)
func (*UniformAPIMock) RegisterIntegration ¶
func (m *UniformAPIMock) RegisterIntegration(integration models.Integration) (string, error)
func (*UniformAPIMock) UnregisterIntegration ¶
func (m *UniformAPIMock) UnregisterIntegration(integrationID string) error