Documentation ¶
Index ¶
- func ClearGlobalTimeMachine(t *testing.T)
- func ExclusiveGlobalTimeMachine(t *testing.T)
- func GlobalTimeMachineCurrentTime() time.Time
- func IsGlobalTimeMachineSet() bool
- func LockGlobalTimeMachine(t *testing.T)
- func NewGlobalTimeMachine(t *testing.T)
- func ResetTimeMachine(startTime time.Time)
- func RunTimeMachine(localLog zerolog.Logger, duration time.Duration, stopTime time.Time)
- type TimeMachine
- func (t *TimeMachine) GetNextTask() (TaskRequirements, *time.Duration)
- func (t *TimeMachine) GetTime() time.Time
- func (t *TimeMachine) InstallTask(task TaskRequirements)
- func (t *TimeMachine) MoreToDo() bool
- func (t *TimeMachine) ProcessTask(task TaskRequirements)
- func (t *TimeMachine) ResumeTask(task TaskRequirements)
- func (t *TimeMachine) String() string
- func (t *TimeMachine) SuspendTask(task TaskRequirements)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearGlobalTimeMachine ¶
ClearGlobalTimeMachine clears the global time machine during the test duration. Usually it is sufficient to use ExclusiveGlobalTimeMachine. Attention: Use in combination with LockGlobalTimeMachine to avoid side effects.
func ExclusiveGlobalTimeMachine ¶
ExclusiveGlobalTimeMachine is a combination of LockGlobalTimeMachine, NewGlobalTimeMachine and ClearGlobalTimeMachine
func GlobalTimeMachineCurrentTime ¶
GlobalTimeMachineCurrentTime Return the current time from the time machine.
func IsGlobalTimeMachineSet ¶
func IsGlobalTimeMachineSet() bool
func LockGlobalTimeMachine ¶
LockGlobalTimeMachine locks the global time machine during the test duration. Usually it is sufficient to use ExclusiveGlobalTimeMachine
func NewGlobalTimeMachine ¶
NewGlobalTimeMachine creates a new TimeMachine and set it as global. Usually it is sufficient to use ExclusiveGlobalTimeMachine
func ResetTimeMachine ¶
ResetTimeMachine This function is called to reset the clock before running a set of tests.
func RunTimeMachine ¶
RunTimeMachine This function is called after a set of tasks have been installed
and they should Run. The machine will stop when the stop time has been reached (maybe the middle of some tests) and can be called again to continue running.
Types ¶
type TimeMachine ¶
type TimeMachine struct { TaskManager // contains filtered or unexported fields }
func NewTimeMachine ¶
func NewTimeMachine(localLog zerolog.Logger) *TimeMachine
func (*TimeMachine) GetNextTask ¶
func (t *TimeMachine) GetNextTask() (TaskRequirements, *time.Duration)
func (*TimeMachine) GetTime ¶
func (t *TimeMachine) GetTime() time.Time
func (*TimeMachine) InstallTask ¶
func (t *TimeMachine) InstallTask(task TaskRequirements)
func (*TimeMachine) MoreToDo ¶
func (t *TimeMachine) MoreToDo() bool
func (*TimeMachine) ProcessTask ¶
func (t *TimeMachine) ProcessTask(task TaskRequirements)
func (*TimeMachine) ResumeTask ¶
func (t *TimeMachine) ResumeTask(task TaskRequirements)
func (*TimeMachine) String ¶
func (t *TimeMachine) String() string
func (*TimeMachine) SuspendTask ¶
func (t *TimeMachine) SuspendTask(task TaskRequirements)