Skip to content

Commit

Permalink
Merge branch 'main' into update-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
cmacknz committed Jul 31, 2024
2 parents 390600f + 5eaebed commit 4846325
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions docker/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
"github.com/docker/docker/api/types/filters"
"github.com/docker/go-connections/tlsconfig"
Expand Down Expand Up @@ -111,7 +112,7 @@ type Container struct {

// Client for docker interface
type Client interface {
ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error)
ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error)
ContainerInspect(ctx context.Context, container string) (types.ContainerJSON, error)
Events(ctx context.Context, options types.EventsOptions) (<-chan events.Message, <-chan error)
}
Expand Down Expand Up @@ -214,7 +215,7 @@ func (w *watcher) Start() error {

w.Lock()
defer w.Unlock()
containers, err := w.listContainers(types.ContainerListOptions{})
containers, err := w.listContainers(container.ListOptions{})
if err != nil {
return err
}
Expand Down Expand Up @@ -330,7 +331,7 @@ func (w *watcher) containerUpdate(event events.Message) {
filter := filters.NewArgs()
filter.Add("id", event.Actor.ID)

containers, err := w.listContainers(types.ContainerListOptions{
containers, err := w.listContainers(container.ListOptions{
Filters: filter,
})
if err != nil || len(containers) != 1 {
Expand Down Expand Up @@ -369,7 +370,7 @@ func (w *watcher) containerDelete(event events.Message) {
}
}

func (w *watcher) listContainers(options types.ContainerListOptions) ([]*Container, error) {
func (w *watcher) listContainers(options container.ListOptions) ([]*Container, error) {
log := w.log

log.Debug("List containers")
Expand Down
3 changes: 2 additions & 1 deletion docker/watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"time"

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/events"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -44,7 +45,7 @@ type MockClient struct {
done chan interface{}
}

func (m *MockClient) ContainerList(ctx context.Context, options types.ContainerListOptions) ([]types.Container, error) {
func (m *MockClient) ContainerList(ctx context.Context, options container.ListOptions) ([]types.Container, error) {
res := m.containers[0]
m.containers = m.containers[1:]
return res, nil
Expand Down

0 comments on commit 4846325

Please sign in to comment.