Skip to content

Commit

Permalink
chore: upgrade to docker v23 and add new mocked funcs (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
plyr4 committed Feb 28, 2023
1 parent 9db0f79 commit 3a4c3a2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.19
require (
github.com/Masterminds/semver/v3 v3.2.0
github.com/docker/distribution v2.8.1+incompatible
github.com/docker/docker v20.10.23+incompatible
github.com/docker/docker v23.0.1+incompatible
github.com/docker/go-units v0.5.0
github.com/gin-gonic/gin v1.9.0
github.com/go-vela/sdk-go v0.17.1-0.20230224164256-73b956037d5b
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68=
github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v20.10.23+incompatible h1:1ZQUUYAdh+oylOT85aA2ZcfRp22jmLhoaEcVEfK8dyA=
github.com/docker/docker v20.10.23+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v23.0.1+incompatible h1:vjgvJZxprTTE1A37nm+CLNAdwu6xZekyoiVlUZEINcY=
github.com/docker/docker v23.0.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
Expand Down
4 changes: 2 additions & 2 deletions mock/docker/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ func (c *ContainerService) ContainerResize(ctx context.Context, ctn string, opti
// a mocked call to restart a Docker container.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.ContainerRestart
func (c *ContainerService) ContainerRestart(ctx context.Context, ctn string, timeout *time.Duration) error {
func (c *ContainerService) ContainerRestart(ctx context.Context, ctn string, options container.StopOptions) error {
return nil
}

Expand Down Expand Up @@ -403,7 +403,7 @@ func (c *ContainerService) ContainerStats(ctx context.Context, ctn string, strea
// a mocked call to stop a Docker container.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.ContainerStop
func (c *ContainerService) ContainerStop(ctx context.Context, ctn string, timeout *time.Duration) error {
func (c *ContainerService) ContainerStop(ctx context.Context, ctn string, options container.StopOptions) error {
// verify a container was provided
if len(ctn) == 0 {
return errors.New("no container provided")
Expand Down
2 changes: 1 addition & 1 deletion mock/docker/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type SystemService struct{}
// from the Docker daemon.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.DiskUsage
func (s *SystemService) DiskUsage(ctx context.Context) (types.DiskUsage, error) {
func (s *SystemService) DiskUsage(ctx context.Context, options types.DiskUsageOptions) (types.DiskUsage, error) {
return types.DiskUsage{}, nil
}

Expand Down
9 changes: 9 additions & 0 deletions mock/docker/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/volume"
"github.com/docker/docker/client"
"github.com/docker/docker/errdefs"
Expand Down Expand Up @@ -174,6 +175,14 @@ func (v *VolumeService) VolumesPrune(ctx context.Context, pruneFilter filters.Ar
return types.VolumesPruneReport{}, nil
}

// VolumeUpdate is a helper function to simulate
// a mocked call to update a Docker volume.
//
// https://pkg.go.dev/github.com/docker/docker/client?tab=doc#Client.VolumeUpdate
func (v *VolumeService) VolumeUpdate(ctx context.Context, volumeID string, version swarm.Version, options volume.UpdateOptions) error {
return nil
}

// WARNING: DO NOT REMOVE THIS UNDER ANY CIRCUMSTANCES
//
// This line serves as a quick and efficient way to ensure that our
Expand Down

0 comments on commit 3a4c3a2

Please sign in to comment.