Documentation
¶
Index ¶
- func ComputeSHA256(data []byte) string
- type CronScheduler
- 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 RealCronScheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeSHA256 ¶
ComputeSHA256 computes the SHA256 hash of data.
Types ¶
type CronScheduler ¶
type CronScheduler interface {
AddFunc(spec string, cmd func()) (cron.EntryID, error)
Remove(id cron.EntryID)
Start()
Stop()
Entries() []cron.Entry
}
CronScheduler is an interface for cron scheduling (for mocking).
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 RealCronScheduler ¶
RealCronScheduler wraps robfig/cron for production use.
func NewRealCronScheduler ¶
func NewRealCronScheduler() *RealCronScheduler
NewRealCronScheduler creates a production cron scheduler.
func (*RealCronScheduler) Start ¶
func (r *RealCronScheduler) Start()
Start starts the cron scheduler.