replace uses of deprecated api/types that moved to api/types/system

These types were moved to api/types/system:

- types.Info
- types.Commit
- types.PluginsInfo
- types.NetworkAddressPool
- types.Runtime
- types.SecurityOpt
- types/KeyValue
- types.DecodeSecurityOptions()

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2023-07-14 23:42:40 +02:00
parent 1f87420b5b
commit 3469beb80d
22 changed files with 122 additions and 111 deletions

View File

@ -6,6 +6,7 @@ import (
. "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/api/types/system"
"github.com/docker/docker/client"
)
@ -15,7 +16,7 @@ type fakeClient struct {
serviceUpdateFunc func(ctx context.Context, serviceID string, version swarm.Version, service swarm.ServiceSpec, options types.ServiceUpdateOptions) (types.ServiceUpdateResponse, error)
serviceListFunc func(context.Context, types.ServiceListOptions) ([]swarm.Service, error)
taskListFunc func(context.Context, types.TaskListOptions) ([]swarm.Task, error)
infoFunc func(ctx context.Context) (types.Info, error)
infoFunc func(ctx context.Context) (system.Info, error)
networkInspectFunc func(ctx context.Context, networkID string, options types.NetworkInspectOptions) (types.NetworkResource, error)
nodeListFunc func(ctx context.Context, options types.NodeListOptions) ([]swarm.Node, error)
}
@ -58,9 +59,9 @@ func (f *fakeClient) ServiceUpdate(ctx context.Context, serviceID string, versio
return types.ServiceUpdateResponse{}, nil
}
func (f *fakeClient) Info(ctx context.Context) (types.Info, error) {
func (f *fakeClient) Info(ctx context.Context) (system.Info, error) {
if f.infoFunc == nil {
return types.Info{}, nil
return system.Info{}, nil
}
return f.infoFunc(ctx)
}

View File

@ -9,6 +9,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/system"
"github.com/google/go-cmp/cmp"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
@ -117,8 +118,8 @@ func TestUpdateNodeFilter(t *testing.T) {
)
client := &fakeClient{
infoFunc: func(_ context.Context) (types.Info, error) {
return types.Info{Swarm: swarm.Info{NodeID: selfNodeID}}, nil
infoFunc: func(_ context.Context) (system.Info, error) {
return system.Info{Swarm: swarm.Info{NodeID: selfNodeID}}, nil
},
}