moby/integration-cli/docker_cli_plugins_test.go

481 lines
18 KiB
Go
Raw Permalink Normal View History

package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"path"
"path/filepath"
"strings"
"testing"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/integration-cli/cli"
"github.com/docker/docker/integration-cli/daemon"
"github.com/docker/docker/testutil"
"github.com/docker/docker/testutil/fixtures/plugin"
"gotest.tools/v3/assert"
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/skip"
)
const (
pluginProcessName = "sample-volume-plugin"
pName = "tiborvass/sample-volume-plugin"
npName = "tiborvass/test-docker-netplugin"
pTag = "latest"
pNameWithTag = pName + ":" + pTag
npNameWithTag = npName + ":" + pTag
)
type DockerCLIPluginsSuite struct {
ds *DockerSuite
}
func (s *DockerCLIPluginsSuite) TearDownTest(ctx context.Context, c *testing.T) {
s.ds.TearDownTest(ctx, c)
}
func (s *DockerCLIPluginsSuite) OnTimeout(c *testing.T) {
s.ds.OnTimeout(c)
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginBasicOps(c *testing.T) {
pluginName := ps.getPluginRepoWithTag()
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pluginName)
assert.NilError(c, err)
out, _, err := dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "true"))
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pluginName)
id = strings.TrimSpace(id)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "remove", pluginName)
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "is enabled"))
_, _, err = dockerCmdWithError("plugin", "disable", pluginName)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "remove", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id))
if !os.IsNotExist(err) {
c.Fatal(err)
}
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginForceRemove(c *testing.T) {
pluginName := ps.getPluginRepoWithTag()
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pluginName)
assert.NilError(c, err)
out, _, _ := dockerCmdWithError("plugin", "remove", pluginName)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "is enabled"))
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
}
func (s *DockerCLIPluginsSuite) TestPluginActive(c *testing.T) {
testRequires(c, DaemonIsLinux, IsAmd64, Network)
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pNameWithTag)
assert.NilError(c, err)
_, _, err = dockerCmdWithError("volume", "create", "-d", pNameWithTag, "--name", "testvol1")
assert.NilError(c, err)
out, _, _ := dockerCmdWithError("plugin", "disable", pNameWithTag)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "in use"))
_, _, err = dockerCmdWithError("volume", "rm", "testvol1")
assert.NilError(c, err)
_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, pNameWithTag))
}
func (s *DockerCLIPluginsSuite) TestPluginActiveNetwork(c *testing.T) {
testRequires(c, DaemonIsLinux, IsAmd64, Network)
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", npNameWithTag)
assert.NilError(c, err)
out, _, err := dockerCmdWithError("network", "create", "-d", npNameWithTag, "test")
assert.NilError(c, err)
nID := strings.TrimSpace(out)
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "is in use"))
_, _, err = dockerCmdWithError("network", "rm", nID)
assert.NilError(c, err)
out, _, _ = dockerCmdWithError("plugin", "remove", npNameWithTag)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "is enabled"))
_, _, err = dockerCmdWithError("plugin", "disable", npNameWithTag)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "remove", npNameWithTag)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, npNameWithTag))
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginInstallDisable(c *testing.T) {
pluginName := ps.getPluginRepoWithTag()
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "false"))
out, _, err = dockerCmdWithError("plugin", "enable", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
out, _, err = dockerCmdWithError("plugin", "disable", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
out, _, err = dockerCmdWithError("plugin", "remove", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
}
func (s *DockerCLIPluginsSuite) TestPluginInstallDisableVolumeLs(c *testing.T) {
testRequires(c, DaemonIsLinux, IsAmd64, Network)
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", "--disable", pName)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, pName))
cli.DockerCmd(c, "volume", "ls")
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginSet(c *testing.T) {
client := testEnv.APIClient()
name := "test"
ctx, cancel := context.WithTimeout(testutil.GetContext(c), 60*time.Second)
defer cancel()
initialValue := "0"
mntSrc := "foo"
devPath := "/dev/bar"
// Create a new plugin with extra settings
err := plugin.Create(ctx, client, name, func(cfg *plugin.Config) {
cfg.Env = []types.PluginEnv{{Name: "DEBUG", Value: &initialValue, Settable: []string{"value"}}}
cfg.Mounts = []types.PluginMount{
{Name: "pmount1", Settable: []string{"source"}, Type: "none", Source: &mntSrc},
{Name: "pmount2", Settable: []string{"source"}, Type: "none"}, // Mount without source is invalid.
}
cfg.Linux.Devices = []types.PluginDevice{
{Name: "pdev1", Path: &devPath, Settable: []string{"path"}},
{Name: "pdev2", Settable: []string{"path"}}, // Device without Path is invalid.
}
})
assert.Assert(c, err == nil, "failed to create test plugin")
env := cli.DockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", name).Stdout()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(env), "[DEBUG=0]"))
cli.DockerCmd(c, "plugin", "set", name, "DEBUG=1")
env = cli.DockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", name).Stdout()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(env), "[DEBUG=1]"))
mounts := cli.DockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name).Stdout()
assert.Check(c, is.Contains(mounts, mntSrc))
cli.DockerCmd(c, "plugin", "set", name, "pmount1.source=bar")
mounts = cli.DockerCmd(c, "plugin", "inspect", "-f", "{{with $mount := index .Settings.Mounts 0}}{{$mount.Source}}{{end}}", name).Stdout()
assert.Check(c, is.Contains(mounts, "bar"))
out, _, err := dockerCmdWithError("plugin", "set", name, "pmount2.source=bar2")
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "Plugin config has no mount source"))
out, _, err = dockerCmdWithError("plugin", "set", name, "pdev2.path=/dev/bar2")
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "Plugin config has no device path"))
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginInstallArgs(c *testing.T) {
pluginName := path.Join(ps.registryHost(), "plugin", "testplugininstallwithargs")
ctx, cancel := context.WithTimeout(testutil.GetContext(c), 60*time.Second)
defer cancel()
plugin.CreateInRegistry(ctx, pluginName, nil, func(cfg *plugin.Config) {
cfg.Env = []types.PluginEnv{{Name: "DEBUG", Settable: []string{"value"}}}
})
out := cli.DockerCmd(c, "plugin", "install", "--grant-all-permissions", "--disable", pluginName, "DEBUG=1").Stdout()
assert.Check(c, is.Contains(out, pluginName))
env := cli.DockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", pluginName).Stdout()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(env), "[DEBUG=1]"))
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginInstallImage(c *testing.T) {
testRequires(c, IsAmd64)
skip.If(c, GitHubActions, "FIXME: https://github.com/moby/moby/issues/43996")
const imgRepo = privateRegistryURL + "/dockercli/busybox"
// tag the image to upload it to the private registry
cli.DockerCmd(c, "tag", "busybox", imgRepo)
// push the image to the registry
cli.DockerCmd(c, "push", imgRepo)
out, _, err := dockerCmdWithError("plugin", "install", imgRepo)
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`))
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginEnableDisableNegative(c *testing.T) {
pluginName := ps.getPluginRepoWithTag()
out, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
out, _, err = dockerCmdWithError("plugin", "enable", pluginName)
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "already enabled"))
_, _, err = dockerCmdWithError("plugin", "disable", pluginName)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "disable", pluginName)
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "already disabled"))
_, _, err = dockerCmdWithError("plugin", "remove", pluginName)
assert.NilError(c, err)
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginCreate(c *testing.T) {
name := "foo/bar-driver"
temp, err := os.MkdirTemp("", "foo")
assert.NilError(c, err)
defer os.RemoveAll(temp)
data := `{"description": "foo plugin"}`
err = os.WriteFile(filepath.Join(temp, "config.json"), []byte(data), 0o644)
assert.NilError(c, err)
err = os.MkdirAll(filepath.Join(temp, "rootfs"), 0o700)
assert.NilError(c, err)
out, _, err := dockerCmdWithError("plugin", "create", name, temp)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
out, _, err = dockerCmdWithError("plugin", "create", name, temp)
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "already exist"))
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
// The output will consists of one HEADER line and one line of foo/bar-driver
rm-gocheck: Equals -> assert.Equal sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Equals, (.*)#assert.Equal(c, \1, \2#g' \ -- "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_volume_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:56 +00:00
assert.Equal(c, len(strings.Split(strings.TrimSpace(out), "\n")), 2)
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginInspect(c *testing.T) {
pluginName := ps.getPluginRepoWithTag()
_, _, err := dockerCmdWithError("plugin", "install", "--grant-all-permissions", pluginName)
assert.NilError(c, err)
out, _, err := dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "true"))
// Find the ID first
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pluginName)
assert.NilError(c, err)
id := strings.TrimSpace(out)
assert.Assert(c, id != "")
// Long form
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(out), id))
// Short form
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(out), id))
// Name with tag form
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", pluginName)
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(out), id))
// Name without tag form
out, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", ps.getPluginRepo())
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(out), id))
_, _, err = dockerCmdWithError("plugin", "disable", pluginName)
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "remove", pluginName)
assert.NilError(c, err)
assert.Check(c, is.Contains(out, pluginName))
// After remove nothing should be found
_, _, err = dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", id[:5])
assert.ErrorContains(c, err, "")
}
// Test case for https://github.com/docker/docker/pull/29186#discussion_r91277345
func (s *DockerCLIPluginsSuite) TestPluginInspectOnWindows(c *testing.T) {
// This test should work on Windows only
testRequires(c, DaemonIsWindows)
out, _, err := dockerCmdWithError("plugin", "inspect", "foobar")
assert.ErrorContains(c, err, "")
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "plugins are not supported on this platform"))
assert.ErrorContains(c, err, "plugins are not supported on this platform")
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginIDPrefix(c *testing.T) {
name := "test"
client := testEnv.APIClient()
ctx, cancel := context.WithTimeout(testutil.GetContext(c), 60*time.Second)
initialValue := "0"
err := plugin.Create(ctx, client, name, func(cfg *plugin.Config) {
cfg.Env = []types.PluginEnv{{Name: "DEBUG", Value: &initialValue, Settable: []string{"value"}}}
})
cancel()
assert.Assert(c, err == nil, "failed to create test plugin")
// Find ID first
id, _, err := dockerCmdWithError("plugin", "inspect", "-f", "{{.Id}}", name)
id = strings.TrimSpace(id)
assert.NilError(c, err)
// List current state
out, _, err := dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
assert.Check(c, is.Contains(out, "false"))
env := cli.DockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", id[:5]).Stdout()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(env), "[DEBUG=0]"))
cli.DockerCmd(c, "plugin", "set", id[:5], "DEBUG=1")
env = cli.DockerCmd(c, "plugin", "inspect", "-f", "{{.Settings.Env}}", id[:5]).Stdout()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Equal(strings.TrimSpace(env), "[DEBUG=1]"))
// Enable
_, _, err = dockerCmdWithError("plugin", "enable", id[:5])
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
assert.Check(c, is.Contains(out, "true"))
// Disable
_, _, err = dockerCmdWithError("plugin", "disable", id[:5])
assert.NilError(c, err)
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, name))
assert.Check(c, is.Contains(out, "false"))
// Remove
_, _, err = dockerCmdWithError("plugin", "remove", id[:5])
assert.NilError(c, err)
// List returns none
out, _, err = dockerCmdWithError("plugin", "ls")
assert.NilError(c, err)
rm-gocheck: Not(Contains) -> !strings.Contains sed -E -i 's#\bassert\.Assert\(c, (.*), checker\.Not\(checker\.Contains\), (.*)\)$#assert.Assert(c, !eg_contains(\1, \2))#g' \ -- "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" \ && \ go get -d golang.org/x/tools/cmd/eg && dir=$(go env GOPATH)/src/golang.org/x/tools && git -C "$dir" fetch https://github.com/tiborvass/tools handle-variadic && git -C "$dir" checkout 61a94b82347c29b3289e83190aa3dda74d47abbb && go install golang.org/x/tools/cmd/eg \ && \ /bin/echo -e 'package main\nvar eg_contains func(arg1, arg2 string, extra ...interface{}) bool' > ./integration-cli/eg_helper.go \ && \ goimports -w ./integration-cli \ && \ eg -w -t template.not_contains.go -- ./integration-cli \ && \ rm -f ./integration-cli/eg_helper.go \ && \ go run rm-gocheck.go redress '\bassert\.Assert\b.*(\(|,)\s*$' \ "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_volume_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:07:46 +00:00
assert.Assert(c, !strings.Contains(out, name))
}
rm-gocheck: check.C -> testing.T sed -E -i 's#\bcheck\.C\b#testing.T#g' \ -- "integration-cli/check_test.go" "integration-cli/daemon/daemon.go" "integration-cli/daemon/daemon_swarm.go" "integration-cli/daemon_swarm_hack_test.go" "integration-cli/docker_api_attach_test.go" "integration-cli/docker_api_build_test.go" "integration-cli/docker_api_build_windows_test.go" "integration-cli/docker_api_containers_test.go" "integration-cli/docker_api_containers_windows_test.go" "integration-cli/docker_api_exec_resize_test.go" "integration-cli/docker_api_exec_test.go" "integration-cli/docker_api_images_test.go" "integration-cli/docker_api_inspect_test.go" "integration-cli/docker_api_logs_test.go" "integration-cli/docker_api_network_test.go" "integration-cli/docker_api_stats_test.go" "integration-cli/docker_api_swarm_node_test.go" "integration-cli/docker_api_swarm_service_test.go" "integration-cli/docker_api_swarm_test.go" "integration-cli/docker_api_test.go" "integration-cli/docker_cli_attach_test.go" "integration-cli/docker_cli_attach_unix_test.go" "integration-cli/docker_cli_build_test.go" "integration-cli/docker_cli_build_unix_test.go" "integration-cli/docker_cli_by_digest_test.go" "integration-cli/docker_cli_commit_test.go" "integration-cli/docker_cli_cp_from_container_test.go" "integration-cli/docker_cli_cp_test.go" "integration-cli/docker_cli_cp_to_container_test.go" "integration-cli/docker_cli_cp_to_container_unix_test.go" "integration-cli/docker_cli_cp_utils_test.go" "integration-cli/docker_cli_create_test.go" "integration-cli/docker_cli_daemon_plugins_test.go" "integration-cli/docker_cli_daemon_test.go" "integration-cli/docker_cli_events_test.go" "integration-cli/docker_cli_events_unix_test.go" "integration-cli/docker_cli_exec_test.go" "integration-cli/docker_cli_exec_unix_test.go" "integration-cli/docker_cli_external_volume_driver_unix_test.go" "integration-cli/docker_cli_health_test.go" "integration-cli/docker_cli_history_test.go" "integration-cli/docker_cli_images_test.go" "integration-cli/docker_cli_import_test.go" "integration-cli/docker_cli_info_test.go" "integration-cli/docker_cli_info_unix_test.go" "integration-cli/docker_cli_inspect_test.go" "integration-cli/docker_cli_links_test.go" "integration-cli/docker_cli_login_test.go" "integration-cli/docker_cli_logout_test.go" "integration-cli/docker_cli_logs_test.go" "integration-cli/docker_cli_netmode_test.go" "integration-cli/docker_cli_network_unix_test.go" "integration-cli/docker_cli_plugins_logdriver_test.go" "integration-cli/docker_cli_plugins_test.go" "integration-cli/docker_cli_port_test.go" "integration-cli/docker_cli_proxy_test.go" "integration-cli/docker_cli_prune_unix_test.go" "integration-cli/docker_cli_ps_test.go" "integration-cli/docker_cli_pull_local_test.go" "integration-cli/docker_cli_pull_test.go" "integration-cli/docker_cli_push_test.go" "integration-cli/docker_cli_registry_user_agent_test.go" "integration-cli/docker_cli_restart_test.go" "integration-cli/docker_cli_rmi_test.go" "integration-cli/docker_cli_run_test.go" "integration-cli/docker_cli_run_unix_test.go" "integration-cli/docker_cli_save_load_test.go" "integration-cli/docker_cli_save_load_unix_test.go" "integration-cli/docker_cli_search_test.go" "integration-cli/docker_cli_service_create_test.go" "integration-cli/docker_cli_service_health_test.go" "integration-cli/docker_cli_service_logs_test.go" "integration-cli/docker_cli_service_scale_test.go" "integration-cli/docker_cli_sni_test.go" "integration-cli/docker_cli_start_test.go" "integration-cli/docker_cli_stats_test.go" "integration-cli/docker_cli_swarm_test.go" "integration-cli/docker_cli_swarm_unix_test.go" "integration-cli/docker_cli_top_test.go" "integration-cli/docker_cli_update_unix_test.go" "integration-cli/docker_cli_userns_test.go" "integration-cli/docker_cli_v2_only_test.go" "integration-cli/docker_cli_volume_test.go" "integration-cli/docker_deprecated_api_v124_test.go" "integration-cli/docker_deprecated_api_v124_unix_test.go" "integration-cli/docker_hub_pull_suite_test.go" "integration-cli/docker_utils_test.go" "integration-cli/events_utils_test.go" "integration-cli/fixtures_linux_daemon_test.go" "integration-cli/utils_test.go" "pkg/discovery/discovery_test.go" "pkg/discovery/file/file_test.go" "pkg/discovery/generator_test.go" "pkg/discovery/kv/kv_test.go" "pkg/discovery/memory/memory_test.go" "pkg/discovery/nodes/nodes_test.go" Signed-off-by: Tibor Vass <tibor@docker.com>
2019-09-09 21:05:55 +00:00
func (ps *DockerPluginSuite) TestPluginListDefaultFormat(c *testing.T) {
config, err := os.MkdirTemp("", "config-file-")
assert.NilError(c, err)
defer os.RemoveAll(config)
err = os.WriteFile(filepath.Join(config, "config.json"), []byte(`{"pluginsFormat": "raw"}`), 0o644)
assert.NilError(c, err)
name := "test:latest"
client := testEnv.APIClient()
ctx, cancel := context.WithTimeout(testutil.GetContext(c), 60*time.Second)
defer cancel()
err = plugin.Create(ctx, client, name, func(cfg *plugin.Config) {
cfg.Description = "test plugin"
})
assert.Assert(c, err == nil, "failed to create test plugin")
id := cli.DockerCmd(c, "plugin", "inspect", "--format", "{{.ID}}", name).Stdout()
id = strings.TrimSpace(id)
// We expect the format to be in `raw + --no-trunc`
expectedOutput := fmt.Sprintf(`plugin_id: %s
name: %s
description: test plugin
enabled: false`, id, name)
out := cli.DockerCmd(c, "--config", config, "plugin", "ls", "--no-trunc").Combined()
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, expectedOutput))
}
func (s *DockerCLIPluginsSuite) TestPluginUpgrade(c *testing.T) {
testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64, NotUserNamespace)
const pluginName = "cpuguy83/docker-volume-driver-plugin-local:latest"
const pluginV2 = "cpuguy83/docker-volume-driver-plugin-local:v2"
cli.DockerCmd(c, "plugin", "install", "--grant-all-permissions", pluginName)
cli.DockerCmd(c, "volume", "create", "--driver", pluginName, "bananas")
cli.DockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "touch /apple/core")
out, _, err := dockerCmdWithError("plugin", "upgrade", "--grant-all-permissions", pluginName, pluginV2)
assert.ErrorContains(c, err, "", out)
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(out, "disabled before upgrading"))
id := cli.DockerCmd(c, "plugin", "inspect", "--format={{.ID}}", pluginName).Stdout()
id = strings.TrimSpace(id)
// make sure "v2" does not exists
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
integration-cli: S1025: the argument is already a string (gosimple) ``` integration-cli/docker_cli_daemon_test.go:1753:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_daemon_test.go:1783:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_daemon_test.go:1893:92: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:444:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:600:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:602:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:610:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:613:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:614:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_external_volume_driver_test.go:617:36: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_plugins_test.go:431:39: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:174:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1046:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1071:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1074:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1079:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1087:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1102:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1108:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1128:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1323:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1329:32: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1388:34: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) integration-cli/docker_cli_swarm_test.go:1985:31: S1025: the argument is already a string, there's no need to use fmt.Sprintf (gosimple) ``` Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-09-11 10:36:00 +00:00
assert.Assert(c, os.IsNotExist(err), out)
cli.DockerCmd(c, "plugin", "disable", "-f", pluginName)
cli.DockerCmd(c, "plugin", "upgrade", "--grant-all-permissions", "--skip-remote-check", pluginName, pluginV2)
// make sure "v2" file exists
_, err = os.Stat(filepath.Join(testEnv.DaemonInfo.DockerRootDir, "plugins", id, "rootfs", "v2"))
assert.NilError(c, err)
cli.DockerCmd(c, "plugin", "enable", pluginName)
cli.DockerCmd(c, "volume", "inspect", "bananas")
cli.DockerCmd(c, "run", "--rm", "-v", "bananas:/apple", "busybox", "sh", "-c", "ls -lh /apple/core")
}
func (s *DockerCLIPluginsSuite) TestPluginMetricsCollector(c *testing.T) {
testRequires(c, DaemonIsLinux, Network, testEnv.IsLocalDaemon, IsAmd64)
d := daemon.New(c, dockerBinary, dockerdBinary)
d.Start(c)
defer d.Stop(c)
name := "cpuguy83/docker-metrics-plugin-test:latest"
r := cli.Docker(cli.Args("plugin", "install", "--grant-all-permissions", name), cli.Daemon(d))
assert.Assert(c, r.Error == nil, r.Combined())
// plugin lisens on localhost:19393 and proxies the metrics
resp, err := http.Get("http://localhost:19393/metrics")
assert.NilError(c, err)
defer resp.Body.Close()
b, err := io.ReadAll(resp.Body)
assert.NilError(c, err)
// check that a known metric is there... don't expect this metric to change over time.. probably safe
integration-cli: DockerPluginSuite: use gotest.tools compare utilities Some of these tests are failing (but not enabled in CI), but the current output doesn't provide any details on the failure, so this patch is just to improve the test output to allow debugging the actual failure. Before this, tests would fail like: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (15.22s) docker_cli_plugins_test.go:220: assertion failed: expression is false: strings.Contains(out, `Encountered remote "application/vnd.docker.container.image.v1+json"(image) when fetching`) --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (15.22s) With this patch, tests provide more useful output: make BIND_DIR=. TEST_FILTER=TestPluginInstallImage test-integration ... === FAIL: amd64.integration-cli TestDockerPluginSuite/TestPluginInstallImage (1.15s) time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" time="2022-10-18T10:21:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:bee151d3fef5c1f787e7846efe4fa42b25a02db4e7543e54e8c679cf19d78598" mediatype=application/vnd.docker.plugin.v1+json size=522 docker_cli_plugins_test.go:221: assertion failed: string "Error response from daemon: application/vnd.docker.distribution.manifest.v1+prettyjws not supported\n" does not contain "Encountered remote \"application/vnd.docker.container.image.v1+json\"(image) when fetching" --- FAIL: TestDockerPluginSuite/TestPluginInstallImage (1.15s) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-26 15:05:19 +00:00
assert.Check(c, is.Contains(string(b), "container_actions"))
}