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 authored 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.