1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 06:28:42 +01:00

test: added test cases for container actions (#2559)

This commit is contained in:
Akash Ramaswamy
2023-12-05 21:18:37 +05:30
committed by GitHub
parent f027c753c1
commit f240b7011b
5 changed files with 212 additions and 5 deletions

View File

@@ -149,14 +149,14 @@ func (d *Client) FindContainer(id string) (Container, error) {
return container, nil
}
func (d *Client) ContainerActions(action string, id string) error {
func (d *Client) ContainerActions(action string, containerID string) error {
switch action {
case "start":
return d.cli.ContainerStart(context.Background(), id, types.ContainerStartOptions{})
return d.cli.ContainerStart(context.Background(), containerID, types.ContainerStartOptions{})
case "stop":
return d.cli.ContainerStop(context.Background(), id, container.StopOptions{})
return d.cli.ContainerStop(context.Background(), containerID, container.StopOptions{})
case "restart":
return d.cli.ContainerRestart(context.Background(), id, container.StopOptions{})
return d.cli.ContainerRestart(context.Background(), containerID, container.StopOptions{})
default:
return fmt.Errorf("unknown action: %s", action)
}