update local code for updated modules

Some tests had to be skipped as there's some issues to address, and
some of the result-types cannot be mocked / stubbed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-10-22 17:05:31 +02:00
parent aeb78091a0
commit 4f7c07cfc2
190 changed files with 3020 additions and 2585 deletions

View File

@ -4,81 +4,79 @@ import (
"context"
"io"
"github.com/moby/moby/api/types/plugin"
"github.com/moby/moby/api/types/system"
"github.com/moby/moby/client"
)
type fakeClient struct {
client.Client
pluginCreateFunc func(createContext io.Reader, options client.PluginCreateOptions) error
pluginDisableFunc func(name string, options client.PluginDisableOptions) error
pluginEnableFunc func(name string, options client.PluginEnableOptions) error
pluginRemoveFunc func(name string, options client.PluginRemoveOptions) error
pluginInstallFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
pluginListFunc func(options client.PluginListOptions) (plugin.ListResponse, error)
pluginInspectFunc func(name string) (*plugin.Plugin, []byte, error)
pluginUpgradeFunc func(name string, options client.PluginInstallOptions) (io.ReadCloser, error)
pluginCreateFunc func(createContext io.Reader, options client.PluginCreateOptions) (client.PluginCreateResult, error)
pluginDisableFunc func(name string, options client.PluginDisableOptions) (client.PluginDisableResult, error)
pluginEnableFunc func(name string, options client.PluginEnableOptions) (client.PluginEnableResult, error)
pluginRemoveFunc func(name string, options client.PluginRemoveOptions) (client.PluginRemoveResult, error)
pluginInstallFunc func(name string, options client.PluginInstallOptions) (client.PluginInstallResult, error)
pluginListFunc func(options client.PluginListOptions) (client.PluginListResult, error)
pluginInspectFunc func(name string) (client.PluginInspectResult, error)
pluginUpgradeFunc func(name string, options client.PluginUpgradeOptions) (client.PluginUpgradeResult, error)
}
func (c *fakeClient) PluginCreate(_ context.Context, createContext io.Reader, options client.PluginCreateOptions) error {
func (c *fakeClient) PluginCreate(_ context.Context, createContext io.Reader, options client.PluginCreateOptions) (client.PluginCreateResult, error) {
if c.pluginCreateFunc != nil {
return c.pluginCreateFunc(createContext, options)
}
return nil
return client.PluginCreateResult{}, nil
}
func (c *fakeClient) PluginEnable(_ context.Context, name string, options client.PluginEnableOptions) error {
func (c *fakeClient) PluginEnable(_ context.Context, name string, options client.PluginEnableOptions) (client.PluginEnableResult, error) {
if c.pluginEnableFunc != nil {
return c.pluginEnableFunc(name, options)
}
return nil
return client.PluginEnableResult{}, nil
}
func (c *fakeClient) PluginDisable(_ context.Context, name string, options client.PluginDisableOptions) error {
func (c *fakeClient) PluginDisable(_ context.Context, name string, options client.PluginDisableOptions) (client.PluginDisableResult, error) {
if c.pluginDisableFunc != nil {
return c.pluginDisableFunc(name, options)
}
return nil
return client.PluginDisableResult{}, nil
}
func (c *fakeClient) PluginRemove(_ context.Context, name string, options client.PluginRemoveOptions) error {
func (c *fakeClient) PluginRemove(_ context.Context, name string, options client.PluginRemoveOptions) (client.PluginRemoveResult, error) {
if c.pluginRemoveFunc != nil {
return c.pluginRemoveFunc(name, options)
}
return nil
return client.PluginRemoveResult{}, nil
}
func (c *fakeClient) PluginInstall(_ context.Context, name string, options client.PluginInstallOptions) (io.ReadCloser, error) {
func (c *fakeClient) PluginInstall(_ context.Context, name string, options client.PluginInstallOptions) (client.PluginInstallResult, error) {
if c.pluginInstallFunc != nil {
return c.pluginInstallFunc(name, options)
}
return nil, nil
return client.PluginInstallResult{}, nil
}
func (c *fakeClient) PluginList(_ context.Context, options client.PluginListOptions) (plugin.ListResponse, error) {
func (c *fakeClient) PluginList(_ context.Context, options client.PluginListOptions) (client.PluginListResult, error) {
if c.pluginListFunc != nil {
return c.pluginListFunc(options)
}
return plugin.ListResponse{}, nil
return client.PluginListResult{}, nil
}
func (c *fakeClient) PluginInspectWithRaw(_ context.Context, name string) (*plugin.Plugin, []byte, error) {
func (c *fakeClient) PluginInspect(_ context.Context, name string, _ client.PluginInspectOptions) (client.PluginInspectResult, error) {
if c.pluginInspectFunc != nil {
return c.pluginInspectFunc(name)
}
return nil, nil, nil
return client.PluginInspectResult{}, nil
}
func (*fakeClient) Info(context.Context) (system.Info, error) {
return system.Info{}, nil
}
func (c *fakeClient) PluginUpgrade(_ context.Context, name string, options client.PluginInstallOptions) (io.ReadCloser, error) {
func (c *fakeClient) PluginUpgrade(_ context.Context, name string, options client.PluginUpgradeOptions) (client.PluginUpgradeResult, error) {
if c.pluginUpgradeFunc != nil {
return c.pluginUpgradeFunc(name, options)
}
// FIXME(thaJeztah): how to mock this?
return nil, nil
}