time_machine

package
v0.0.0-...-a6dc647 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearGlobalTimeMachine

func ClearGlobalTimeMachine(t *testing.T)

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

func ExclusiveGlobalTimeMachine(t *testing.T)

ExclusiveGlobalTimeMachine is a combination of LockGlobalTimeMachine, NewGlobalTimeMachine and ClearGlobalTimeMachine

func GlobalTimeMachineCurrentTime

func GlobalTimeMachineCurrentTime() time.Time

GlobalTimeMachineCurrentTime Return the current time from the time machine.

func IsGlobalTimeMachineSet

func IsGlobalTimeMachineSet() bool

func LockGlobalTimeMachine

func LockGlobalTimeMachine(t *testing.T)

LockGlobalTimeMachine locks the global time machine during the test duration. Usually it is sufficient to use ExclusiveGlobalTimeMachine

func NewGlobalTimeMachine

func NewGlobalTimeMachine(t *testing.T)

NewGlobalTimeMachine creates a new TimeMachine and set it as global. Usually it is sufficient to use ExclusiveGlobalTimeMachine

func ResetTimeMachine

func ResetTimeMachine(startTime time.Time)

ResetTimeMachine This function is called to reset the clock before running a set of tests.

func RunTimeMachine

func RunTimeMachine(localLog zerolog.Logger, duration time.Duration, stopTime time.Time)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL