Documentation
¶
Index ¶
- func BuildTestJAR(filename, content string) []byte
- func BuildTestJARMulti(files map[string]string) []byte
- func ComputeSHA256(data []byte) string
- type ExecCall
- type MockCronJob
- type MockCronScheduler
- func (m *MockCronScheduler) AddFunc(spec string, cmd func()) (cron.EntryID, error)
- func (m *MockCronScheduler) Entries() []cron.Entry
- func (m *MockCronScheduler) GetJob(id cron.EntryID) *MockCronJob
- func (m *MockCronScheduler) GetJobBySpec(spec string) *MockCronJob
- func (m *MockCronScheduler) Remove(id cron.EntryID)
- func (m *MockCronScheduler) Reset()
- func (m *MockCronScheduler) Start()
- func (m *MockCronScheduler) Stop()
- func (m *MockCronScheduler) TriggerJob(id cron.EntryID)
- type MockHTTPServer
- type MockMetricsRecorder
- func (m *MockMetricsRecorder) RecordPluginAPICall(source string, _ error, _ time.Duration)
- func (m *MockMetricsRecorder) RecordReconcile(_ string, _ error, _ time.Duration)
- func (m *MockMetricsRecorder) RecordSolverRun(_ string, _ error, _ time.Duration)
- func (m *MockMetricsRecorder) RecordUpdate(_ bool)
- type MockPaperAPI
- type MockPluginClient
- type MockPodExecutor
- type MockPodExecutorFunc
- type MockRegistryAPI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildTestJAR ¶
BuildTestJAR creates an in-memory JAR (ZIP) file with a single entry. Panics on error since this is a test utility.
func BuildTestJARMulti ¶
BuildTestJARMulti creates an in-memory JAR (ZIP) file with multiple entries. Panics on error since this is a test utility.
func ComputeSHA256 ¶
ComputeSHA256 computes the SHA256 hash of data.
Types ¶
type MockCronJob ¶
MockCronJob represents a cron job in the mock.
type MockCronScheduler ¶
type MockCronScheduler struct {
// Track added jobs
Jobs map[cron.EntryID]*MockCronJob
// Control behavior
AddFuncError error
Started bool
// contains filtered or unexported fields
}
MockCronScheduler is a mock cron scheduler for testing.
func NewMockCronScheduler ¶
func NewMockCronScheduler() *MockCronScheduler
NewMockCronScheduler creates a new mock cron scheduler.
func (*MockCronScheduler) AddFunc ¶
func (m *MockCronScheduler) AddFunc(spec string, cmd func()) (cron.EntryID, error)
AddFunc adds a cron job to the mock.
func (*MockCronScheduler) Entries ¶
func (m *MockCronScheduler) Entries() []cron.Entry
Entries returns all cron entries (mock implementation).
func (*MockCronScheduler) GetJob ¶
func (m *MockCronScheduler) GetJob(id cron.EntryID) *MockCronJob
GetJob returns a cron job by ID (for testing).
func (*MockCronScheduler) GetJobBySpec ¶
func (m *MockCronScheduler) GetJobBySpec(spec string) *MockCronJob
GetJobBySpec returns the first cron job matching the spec (for testing).
func (*MockCronScheduler) Remove ¶
func (m *MockCronScheduler) Remove(id cron.EntryID)
Remove removes a cron job from the mock.
func (*MockCronScheduler) Start ¶
func (m *MockCronScheduler) Start()
Start marks the scheduler as started.
func (*MockCronScheduler) Stop ¶
func (m *MockCronScheduler) Stop()
Stop marks the scheduler as stopped.
func (*MockCronScheduler) TriggerJob ¶
func (m *MockCronScheduler) TriggerJob(id cron.EntryID)
TriggerJob manually triggers a cron job by ID (for testing).
type MockHTTPServer ¶
type MockHTTPServer struct {
Server *httptest.Server
// Track download requests
Downloads []string
// Control behavior
FailOnPath map[string]bool
FileData map[string][]byte
// contains filtered or unexported fields
}
MockHTTPServer is a test HTTP server for simulating JAR downloads.
func NewMockHTTPServer ¶
func NewMockHTTPServer() *MockHTTPServer
NewMockHTTPServer creates a new mock HTTP server.
func (*MockHTTPServer) AddFile ¶
func (m *MockHTTPServer) AddFile(path string, data []byte)
AddFile adds a file to be served at the given path.
func (*MockHTTPServer) GetDownloads ¶
func (m *MockHTTPServer) GetDownloads() []string
GetDownloads returns a copy of recorded download paths.
func (*MockHTTPServer) SetFailOnPath ¶
func (m *MockHTTPServer) SetFailOnPath(path string, fail bool)
SetFailOnPath makes the server return an error for the given path.
func (*MockHTTPServer) URL ¶
func (m *MockHTTPServer) URL() string
URL returns the base URL of the mock server.
type MockMetricsRecorder ¶
type MockMetricsRecorder struct {
PluginAPICalls int
PluginAPISources []string
// contains filtered or unexported fields
}
MockMetricsRecorder implements metrics.Recorder with call tracking.
func (*MockMetricsRecorder) RecordPluginAPICall ¶
func (m *MockMetricsRecorder) RecordPluginAPICall(source string, _ error, _ time.Duration)
RecordPluginAPICall records the source type.
func (*MockMetricsRecorder) RecordReconcile ¶
func (m *MockMetricsRecorder) RecordReconcile(_ string, _ error, _ time.Duration)
RecordReconcile is a no-op.
func (*MockMetricsRecorder) RecordSolverRun ¶
func (m *MockMetricsRecorder) RecordSolverRun(_ string, _ error, _ time.Duration)
RecordSolverRun is a no-op.
func (*MockMetricsRecorder) RecordUpdate ¶
func (m *MockMetricsRecorder) RecordUpdate(_ bool)
RecordUpdate is a no-op.
type MockPaperAPI ¶
type MockPaperAPI struct {
// Configurable responses
Versions []string
VersionsErr error
BuildInfo *paper.BuildInfo
BuildInfoErr error
BuildNumbers []int
BuildsErr error
// Track calls
GetVersionsCalls int
GetBuildCalls []string
GetBuildsCalls []string
// contains filtered or unexported fields
}
MockPaperAPI is a mock implementation of controller.PaperAPI for testing.
func (*MockPaperAPI) GetPaperBuild ¶
GetPaperBuild returns the configured build info or error.
func (*MockPaperAPI) GetPaperVersions ¶
func (m *MockPaperAPI) GetPaperVersions(_ context.Context) ([]string, error)
GetPaperVersions returns the configured versions or error.
type MockPluginClient ¶
type MockPluginClient struct {
// Responses
Versions []plugins.PluginVersion
VersionErr error
CompatInfo plugins.CompatibilityInfo
CompatErr error
// Call tracking
GetVersionsCalls int
GetVersionsProjects []string
GetCompatCalls int
GetCompatProjects []string
GetCompatVersions []string
// contains filtered or unexported fields
}
MockPluginClient implements plugins.PluginClient for controller testing.
func (*MockPluginClient) GetCompatibility ¶
func (m *MockPluginClient) GetCompatibility( ctx context.Context, project, version string, ) (plugins.CompatibilityInfo, error)
GetCompatibility returns configured compatibility info or error.
func (*MockPluginClient) GetVersions ¶
func (m *MockPluginClient) GetVersions(ctx context.Context, project string) ([]plugins.PluginVersion, error)
GetVersions returns configured versions or error.
type MockPodExecutor ¶
type MockPodExecutor struct {
Calls []ExecCall
Output []byte
Err error
// contains filtered or unexported fields
}
MockPodExecutor records calls and returns configurable responses.
type MockPodExecutorFunc ¶
type MockPodExecutorFunc struct {
Calls []ExecCall
ExecFunc func(ctx context.Context, namespace, podName, container string, command []string) ([]byte, error)
// contains filtered or unexported fields
}
MockPodExecutorFunc records calls and delegates to a custom function for responses. Use this when different commands need different outputs (e.g., curl → sha256sum → rm).
type MockRegistryAPI ¶
type MockRegistryAPI struct {
// Configurable responses
Tags []string
TagsErr error
ImageExist bool
ImageErr error
// Per-tag existence for fine-grained control
TagExists map[string]bool
// Track calls
ListTagsCalls int
ImageExistCalls []string
// contains filtered or unexported fields
}
MockRegistryAPI is a mock implementation of controller.RegistryAPI for testing.
func (*MockRegistryAPI) ImageExists ¶
ImageExists returns the configured existence or error.