Files
docker-cli/e2e/plugin/plugin_test.go
Sebastiaan van Stijn 3f5b1bdd32 cli/command/plugin: remove DCT
Plugins are not widely used, and there's no known plugins that use
content-trust. We're working on updating the authentication stack
in the CLI, and the trust implementation hinders us in making
changes, so removing parts that are not high-priority (ahead of
full deprecation of DCT).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-08-06 12:33:27 +02:00

59 lines
1.6 KiB
Go

package plugin
import (
"context"
"fmt"
"testing"
"github.com/docker/cli/e2e/internal/fixtures"
"github.com/docker/cli/e2e/testutils"
"github.com/docker/cli/internal/test/environment"
"gotest.tools/v3/icmd"
"gotest.tools/v3/skip"
)
const registryPrefix = "registry:5000"
func TestCreatePushPull(t *testing.T) {
skip.If(t, environment.SkipPluginTests())
const pluginName = registryPrefix + "/my-plugin"
// TODO(thaJeztah): probably should use a config without the content trust bits.
dir := fixtures.SetupConfigFile(t)
defer dir.Remove()
ctx, cancel := context.WithCancel(context.Background())
t.Cleanup(cancel)
pluginDir := testutils.SetupPlugin(t, ctx)
icmd.RunCommand("docker", "plugin", "create", pluginName, pluginDir).Assert(t, icmd.Success)
result := icmd.RunCmd(icmd.Command("docker", "plugin", "push", pluginName),
fixtures.WithConfig(dir.Path()),
fixtures.WithPassphrase("foo", "bar"),
)
result.Assert(t, icmd.Expected{
Out: fmt.Sprintf("The push refers to repository [%s]", pluginName),
})
icmd.RunCommand("docker", "plugin", "rm", "-f", pluginName).Assert(t, icmd.Success)
result = icmd.RunCmd(icmd.Command("docker", "plugin", "install", "--grant-all-permissions", pluginName),
fixtures.WithConfig(dir.Path()),
)
result.Assert(t, icmd.Expected{
Out: "Installed plugin " + pluginName,
})
}
func TestInstall(t *testing.T) {
skip.If(t, environment.SkipPluginTests())
const pluginName = "tiborvass/sample-volume-plugin:latest"
result := icmd.RunCmd(icmd.Command("docker", "plugin", "install", "--grant-all-permissions", pluginName))
result.Assert(t, icmd.Expected{
Out: "Installed plugin " + pluginName,
})
}