Documentation ¶
Index ¶
- type ComposeFormat
- type DockerMockManager
- func (d *DockerMockManager) Config(projectName string, composeFilePaths []string, format ComposeFormat) (string, error)
- func (d *DockerMockManager) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
- func (d *DockerMockManager) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
- func (d *DockerMockManager) ContainerRemove(ctx context.Context, containerID string, opts container.RemoveOptions) error
- func (d *DockerMockManager) ContainerRestart(ctx context.Context, containerID string, opts container.StopOptions) error
- func (d *DockerMockManager) ContainerStart(ctx context.Context, containerID string, opts container.StartOptions) error
- func (d *DockerMockManager) ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error
- func (d *DockerMockManager) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
- func (d *DockerMockManager) Down(projectName string, composeFilePaths []string) error
- func (d *DockerMockManager) Mock_AddContainer(info types.ContainerJSON) error
- func (d *DockerMockManager) Mock_AddVolume(volume volume.Volume) error
- func (d *DockerMockManager) Mock_SetContainerDiskUsage(containerID string, sizeRootFs int64, sizeRw int64) error
- func (d *DockerMockManager) Mock_SetVolumeDiskUsage(volumeID string, size int64) error
- func (d *DockerMockManager) NetworkRemove(ctx context.Context, networkID string) error
- func (m *DockerMockManager) RevertToSnapshot(name string) error
- func (d *DockerMockManager) Stop(projectName string, composeFilePaths []string) error
- func (m *DockerMockManager) TakeSnapshot(name string) error
- func (d *DockerMockManager) Up(projectName string, composeFilePaths []string) error
- func (d *DockerMockManager) VolumeRemove(ctx context.Context, volumeID string, force bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComposeFormat ¶
type ComposeFormat string
Format for compose output
const ( // Output in JSON format ComposeFormat_JSON ComposeFormat = "json" // Output in YAML format ComposeFormat_YAML ComposeFormat = "yaml" )
type DockerMockManager ¶ added in v0.2.0
func NewDockerMockManager ¶ added in v0.2.0
func NewDockerMockManager(logger *slog.Logger) *DockerMockManager
Creates a new Docker mock manager instance
func (*DockerMockManager) Config ¶ added in v0.2.0
func (d *DockerMockManager) Config(projectName string, composeFilePaths []string, format ComposeFormat) (string, error)
Emulates a `docker compose config` command, returning the YAML configuration for the provided project.
func (*DockerMockManager) ContainerInspect ¶ added in v0.2.0
func (d *DockerMockManager) ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
Returns information about a container.
func (*DockerMockManager) ContainerList ¶ added in v0.2.0
func (d *DockerMockManager) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
Lists all running Docker containers (unless options.All is true, in which case lists all containers). The other options are not implemented.
func (*DockerMockManager) ContainerRemove ¶ added in v0.2.0
func (d *DockerMockManager) ContainerRemove(ctx context.Context, containerID string, opts container.RemoveOptions) error
Removes a container. The opts are not implemented.
func (*DockerMockManager) ContainerRestart ¶ added in v0.2.0
func (d *DockerMockManager) ContainerRestart(ctx context.Context, containerID string, opts container.StopOptions) error
Restarts a container. The opts are not implemented.
func (*DockerMockManager) ContainerStart ¶ added in v0.2.0
func (d *DockerMockManager) ContainerStart(ctx context.Context, containerID string, opts container.StartOptions) error
Starts a container. The opts are not implemented.
func (*DockerMockManager) ContainerStop ¶ added in v0.2.0
func (d *DockerMockManager) ContainerStop(ctx context.Context, containerID string, options container.StopOptions) error
Stops a container. The opts are not implemented.
func (*DockerMockManager) DiskUsage ¶ added in v0.2.0
func (d *DockerMockManager) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error)
Gets the current disk usage of each Docker resource. These must be explicitly set before calling this with Mock_SetContainerDiskUsage() or Mock_SetVolumeDiskUsage(). options are not implemented; always returns container and volume info.
func (*DockerMockManager) Down ¶ added in v0.2.0
func (d *DockerMockManager) Down(projectName string, composeFilePaths []string) error
Emulates a `docker compose down` command, stopping and removing the provided services, volumes, and networks.
func (*DockerMockManager) Mock_AddContainer ¶ added in v0.2.0
func (d *DockerMockManager) Mock_AddContainer(info types.ContainerJSON) error
Adds a container to the mock registry. Note that this does not add any new volumes the container references; add those manually with Mock_AddVolume().
func (*DockerMockManager) Mock_AddVolume ¶ added in v0.2.0
func (d *DockerMockManager) Mock_AddVolume(volume volume.Volume) error
Adds a volume to the mock registry.
func (*DockerMockManager) Mock_SetContainerDiskUsage ¶ added in v0.2.0
func (d *DockerMockManager) Mock_SetContainerDiskUsage(containerID string, sizeRootFs int64, sizeRw int64) error
Sets a container's disk usage
func (*DockerMockManager) Mock_SetVolumeDiskUsage ¶ added in v0.2.0
func (d *DockerMockManager) Mock_SetVolumeDiskUsage(volumeID string, size int64) error
Sets a container's disk usage
func (*DockerMockManager) NetworkRemove ¶ added in v0.2.0
func (d *DockerMockManager) NetworkRemove(ctx context.Context, networkID string) error
Deletes a network if not being used by existing containers.
func (*DockerMockManager) RevertToSnapshot ¶ added in v0.2.0
func (m *DockerMockManager) RevertToSnapshot(name string) error
Revert to a snapshot of the Docker mock state
func (*DockerMockManager) Stop ¶ added in v0.2.0
func (d *DockerMockManager) Stop(projectName string, composeFilePaths []string) error
Emulates a `docker compose stop` command, stopping the provided services.
func (*DockerMockManager) TakeSnapshot ¶ added in v0.2.0
func (m *DockerMockManager) TakeSnapshot(name string) error
Creates a new snapshot of the current state of the Docker mock manager
func (*DockerMockManager) Up ¶ added in v0.2.0
func (d *DockerMockManager) Up(projectName string, composeFilePaths []string) error
Emulates a `docker compose up` command, starting the provided project by generating the specified networks, volumes, and services (containers).
func (*DockerMockManager) VolumeRemove ¶ added in v0.2.0
Deletes a volume. Always works, force is not used.