Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RETRY_WAIT = func() int { return map[bool]int{true: 0, false: 2}[os.Getenv("CI") == "true"] }()
RETRY_WAIT is the number of seconds to wait between retries when starting or stopping a VM If running in CI, no wait is performed
Functions ¶
This section is empty.
Types ¶
type BaseVirt ¶
type BaseVirt struct {
// contains filtered or unexported fields
}
func NewBaseVirt ¶
NewBaseVirt creates a new BaseVirt instance
func (*BaseVirt) Initialize ¶
Initialize is a method that initializes the virt environment
type ColimaVirt ¶
type ColimaVirt struct {
BaseVirt
}
ColimaVirt implements the VirtInterface and VMInterface for Colima
func NewColimaVirt ¶
func NewColimaVirt(injector di.Injector) *ColimaVirt
NewColimaVirt creates a new instance of ColimaVirt using a DI injector
func (*ColimaVirt) GetVMInfo ¶
func (v *ColimaVirt) GetVMInfo() (VMInfo, error)
GetVMInfo returns the information about the Colima VM
func (*ColimaVirt) PrintInfo ¶
func (v *ColimaVirt) PrintInfo() error
PrintInfo prints the information about the Colima VM
func (*ColimaVirt) WriteConfig ¶
func (v *ColimaVirt) WriteConfig() error
WriteConfig writes the Colima configuration file
type ContainerInfo ¶
type ContainerRuntime ¶
type ContainerRuntime interface { Virt GetContainerInfo(name ...string) ([]ContainerInfo, error) }
ContainerRuntime defines methods for container operations
type DockerVirt ¶
type DockerVirt struct { BaseVirt // contains filtered or unexported fields }
DockerVirt implements the ContainerInterface for Docker
func NewDockerVirt ¶
func NewDockerVirt(injector di.Injector) *DockerVirt
NewDockerVirt creates a new instance of DockerVirt using a DI injector
func (*DockerVirt) GetContainerInfo ¶
func (v *DockerVirt) GetContainerInfo(name ...string) ([]ContainerInfo, error)
GetContainerInfo returns a list of information about the Docker containers, including their labels
func (*DockerVirt) Initialize ¶
func (v *DockerVirt) Initialize() error
Initialize resolves the dependencies for DockerVirt
func (*DockerVirt) PrintInfo ¶
func (v *DockerVirt) PrintInfo() error
PrintInfo prints the container information
func (*DockerVirt) WriteConfig ¶
func (v *DockerVirt) WriteConfig() error
WriteConfig writes the Docker configuration file
type MockVirt ¶
type MockVirt struct { InitializeFunc func() error UpFunc func(verbose ...bool) error DownFunc func() error PrintInfoFunc func() error WriteConfigFunc func() error GetVMInfoFunc func() (VMInfo, error) GetContainerInfoFunc func(name ...string) ([]ContainerInfo, error) }
MockVirt is a struct that simulates a virt environment for testing purposes.
func (*MockVirt) Down ¶
Down stops the mock virt. If a custom DownFunc is provided, it will use that function instead.
func (*MockVirt) GetContainerInfo ¶
func (m *MockVirt) GetContainerInfo(name ...string) ([]ContainerInfo, error)
GetContainerInfo retrieves information about the mock containers. If a custom GetContainerInfoFunc is provided, it will use that function instead.
func (*MockVirt) GetVMInfo ¶
GetVMInfo retrieves information about the mock VM. If a custom GetVMInfoFunc is provided, it will use that function instead.
func (*MockVirt) Initialize ¶
Initialize initializes the mock virt. If a custom InitializeFunc is provided, it will use that function instead.
func (*MockVirt) PrintInfo ¶
PrintInfo prints information about the mock virt. If a custom PrintInfoFunc is provided, it will use that function instead.
func (*MockVirt) Up ¶
Up starts the mock virt. If a custom UpFunc is provided, it will use that function instead.
func (*MockVirt) WriteConfig ¶
WriteConfig writes the configuration of the mock virt. If a custom WriteConfigFunc is provided, it will use that function instead.
type Virt ¶
type Virt interface { Initialize() error Up() error Down() error PrintInfo() error WriteConfig() error }
Virt defines methods for the virt operations
type VirtualMachine ¶
VirtualMachine defines methods for VirtualMachine operations
type YAMLEncoder ¶
YAMLEncoder is an interface for encoding YAML data.