mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Merge pull request #51254 from thaJeztah/refactor_plugin_inspect
client: PluginInspectWithRaw: refactor and rename to PluginInspect
This commit is contained in:
@@ -67,12 +67,12 @@ func (d *Daemon) CheckServiceUpdateState(ctx context.Context, service string) fu
|
||||
func (d *Daemon) CheckPluginRunning(ctx context.Context, plugin string) func(c *testing.T) (any, string) {
|
||||
return func(t *testing.T) (any, string) {
|
||||
apiclient := d.NewClientT(t)
|
||||
resp, _, err := apiclient.PluginInspectWithRaw(ctx, plugin)
|
||||
resp, err := apiclient.PluginInspect(ctx, plugin, client.PluginInspectOptions{})
|
||||
if cerrdefs.IsNotFound(err) {
|
||||
return false, fmt.Sprintf("%v", err)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
return resp.Enabled, fmt.Sprintf("%+v", resp)
|
||||
return resp.Plugin.Enabled, fmt.Sprintf("%+v", resp.Plugin)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ func (d *Daemon) CheckPluginRunning(ctx context.Context, plugin string) func(c *
|
||||
func (d *Daemon) CheckPluginImage(ctx context.Context, plugin string) func(c *testing.T) (any, string) {
|
||||
return func(t *testing.T) (any, string) {
|
||||
apiclient := d.NewClientT(t)
|
||||
resp, _, err := apiclient.PluginInspectWithRaw(ctx, plugin)
|
||||
resp, err := apiclient.PluginInspect(ctx, plugin, client.PluginInspectOptions{})
|
||||
if cerrdefs.IsNotFound(err) {
|
||||
return false, fmt.Sprintf("%v", err)
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
return resp.PluginReference, fmt.Sprintf("%+v", resp)
|
||||
return resp.Plugin.PluginReference, fmt.Sprintf("%+v", resp.Plugin)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2225,11 +2225,11 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) {
|
||||
|
||||
ctx, cancel = context.WithTimeout(testutil.GetContext(c), 30*time.Second)
|
||||
defer cancel()
|
||||
p, _, err := apiClient.PluginInspectWithRaw(ctx, name)
|
||||
res, err := apiClient.PluginInspect(ctx, name, client.PluginInspectOptions{})
|
||||
assert.NilError(c, err)
|
||||
|
||||
// simulate a bad/partial removal by removing the plugin config.
|
||||
configPath := filepath.Join(d.Root, "plugins", p.ID, "config.json")
|
||||
configPath := filepath.Join(d.Root, "plugins", res.Plugin.ID, "config.json")
|
||||
assert.NilError(c, os.Remove(configPath))
|
||||
|
||||
d.Restart(c)
|
||||
@@ -2238,7 +2238,7 @@ func (s *DockerDaemonSuite) TestFailedPluginRemove(c *testing.T) {
|
||||
_, err = apiClient.Ping(ctx)
|
||||
assert.NilError(c, err)
|
||||
|
||||
_, _, err = apiClient.PluginInspectWithRaw(ctx, name)
|
||||
_, err = apiClient.PluginInspect(ctx, name, client.PluginInspectOptions{})
|
||||
// plugin should be gone since the config.json is gone
|
||||
assert.ErrorContains(c, err, "")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user