1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli
Paulo Ribeiro 55cdb6dcd0
Add a check for size field in custom format string
This fix addresses an issue where including the `{{.Size}}` format
field in conjunction with `docker ps --format`, without the `--size`
flag, would not correctly display the size of containers.

This is done by doing a check on the custom format string, and setting
the size flag on the options struct if the field is found. This struct
gets passed to the engine API which then generates the correct query.

An integration test is included which runs `docker ps --format "table
{{.Size}}"` without `--size`, and checks that the returned output is
not `0 B`.

Fixes #21991

As suggested by @cpuguy83, a parser is implemented to process the format
string as a template, and then traverses the template tree to determine
if `.Size` was called.

This was then reworked by making use of template execution with a
pre-processor struct that will set the `--size` option if the template
calls for the field.

The pre-processor now also sets a boolean in the context passed to the
writer. There is an integration test for this that calls `docker ps
--size --format "{{.Size}}"` and then checks that `size: {{.Size}}` is
not appended, as it would with previous behavior.

Finally, a change was made to the formatter to not automatically
add a `{{.Size}}` if a custom format is provided.

Signed-off-by: Paulo Ribeiro <paigr.io@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-03 21:59:10 +02:00
..
fixtures Trusted push now adds the tag to every first level delegation role for which we have keys 2016-03-21 10:56:09 -07:00
benchmark_test.go Move layer mount refcounts to mountedLayer 2016-03-23 14:42:52 -07:00
check_test.go Add test for targets/releases preference when pulling 2016-03-21 10:56:42 -07:00
daemon.go Use dockerd instead of docker daemon in integration-cli 2016-05-26 13:14:35 +02:00
docker_api_attach_test.go Let client print error when speicify wrong detach keys 2016-04-04 15:35:55 +08:00
docker_api_auth_test.go skip TestAuthApi if no network is available 2016-04-25 20:12:36 +02:00
docker_api_build_test.go Fix build cache false positives when build context tar contains unnormalized paths 2016-04-14 17:57:45 -07:00
docker_api_containers_test.go remove deprecated feature of passing HostConfig at API container start 2016-06-01 22:25:17 +08:00
docker_api_create_test.go
docker_api_events_test.go Windows CI: Integrity check for busybox top 2016-02-24 11:00:47 -08:00
docker_api_exec_resize_test.go
docker_api_exec_test.go Fix TestExecApiStartWithDetach on WindowsTP4 2016-02-25 14:27:22 +01:00
docker_api_images_test.go
docker_api_info_test.go Show "seccomp" in docker info (#20909). 2016-03-30 09:23:15 +00:00
docker_api_inspect_test.go
docker_api_inspect_unix_test.go
docker_api_logs_test.go Windows CI Reliablity: TestLogsApiWithStdout 2016-03-02 10:26:15 -08:00
docker_api_network_test.go Update client code with api changes 2016-04-15 12:48:01 +02:00
docker_api_resize_test.go
docker_api_stats_test.go Fix flaky TestApiStatsNetworkStats test 2016-05-23 19:00:19 -07:00
docker_api_stats_unix_test.go TestApiStatsContainerGetMemoryLimit: Add cgroup memory test 2016-05-04 20:46:41 +02:00
docker_api_test.go Update code for latest engine-api 2016-04-19 16:56:54 +02:00
docker_api_update_unix_test.go
docker_api_version_test.go
docker_api_volumes_test.go integration-cli: remove not necessary -d again 2016-02-28 13:48:15 +01:00
docker_cli_attach_test.go Better error on attach no tty 2016-05-25 13:32:48 -07:00
docker_cli_attach_unix_test.go Improve remote integration-cli tests 2016-02-11 07:31:49 -08:00
docker_cli_authz_unix_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_build_test.go Add support for comment in .dockerignore 2016-06-02 19:06:52 -07:00
docker_cli_build_unix_test.go Fix events test flakiness. 2016-02-18 16:10:29 -05:00
docker_cli_by_digest_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_commit_test.go Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c 2016-02-29 19:28:37 +08:00
docker_cli_config_test.go Support TLS remote test daemon 2016-02-25 14:12:17 -05:00
docker_cli_cp_from_container_test.go
docker_cli_cp_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_cp_to_container_test.go
docker_cli_cp_to_container_unix_test.go Fix copy chown settings to not default to real root 2016-02-18 14:44:13 -08:00
docker_cli_cp_utils.go
docker_cli_create_test.go fix TestCreateShrinkRootfs and TestCreateShrinkRootfs 2016-04-06 12:40:20 -04:00
docker_cli_daemon_experimental_test.go Fix containerd proto for connection 2016-05-09 15:17:10 -07:00
docker_cli_daemon_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_diff_test.go integration-cli: fix wrong test and add log 2016-03-24 11:10:41 +01:00
docker_cli_events_test.go Add load/save image event support 2016-04-27 01:11:03 +00:00
docker_cli_events_unix_test.go Add filter for events emitted by docker daemon 2016-05-23 19:00:47 -07:00
docker_cli_exec_test.go Better error on attach no tty 2016-05-25 13:32:48 -07:00
docker_cli_exec_unix_test.go Revert hack in TestExecTTY 2016-03-08 10:54:18 +08:00
docker_cli_experimental_test.go
docker_cli_export_import_test.go
docker_cli_external_graphdriver_unix_test.go Initialize activateWait for plugins activated by json spec 2016-04-20 05:59:19 -07:00
docker_cli_external_volume_driver_unix_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_health_test.go Add support for user-defined healthchecks 2016-06-02 23:58:34 +02:00
docker_cli_help_test.go Use Args in cobra.Command to validate args. 2016-05-31 15:43:16 -07:00
docker_cli_history_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_images_test.go Remove deprecated -f flag on docker tag 2016-06-01 09:44:25 -07:00
docker_cli_import_test.go Fix docker import tests 2016-05-23 15:34:40 -07:00
docker_cli_info_test.go make Insecure registries uppercase like other keys in docker info 2016-04-25 18:44:34 +08:00
docker_cli_inspect_experimental_test.go
docker_cli_inspect_test.go Expose RootFS in image inspect 2016-03-22 13:49:30 -07:00
docker_cli_kill_test.go Windows CI: Port TestKill* 2016-02-24 13:33:25 -08:00
docker_cli_links_test.go
docker_cli_links_unix_test.go
docker_cli_login_test.go distribution: errors: do not access the errors slice if it's empty 2016-03-16 09:00:39 +01:00
docker_cli_logout_test.go Change v1 pull 404 message to include tag 2016-03-29 10:04:59 -07:00
docker_cli_logs_bench_test.go Fixes some issues with jsonfile write/read 2016-03-21 11:05:58 -04:00
docker_cli_logs_test.go Add support for reading logs extra attrs 2016-05-06 20:42:20 -04:00
docker_cli_nat_test.go
docker_cli_netmode_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_network_unix_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_oom_killed_test.go Add the swapMemorySupport requirement to OOM tests 2016-05-10 11:28:00 -07:00
docker_cli_pause_test.go Get events until a time in the past. 2016-04-14 16:22:16 -07:00
docker_cli_port_test.go Expose bridge IPv6 setting to docker network inspect 2016-02-11 22:13:47 +00:00
docker_cli_proxy_test.go Support TLS remote test daemon 2016-02-25 14:12:17 -05:00
docker_cli_ps_test.go Add a check for size field in custom format string 2016-06-03 21:59:10 +02:00
docker_cli_pull_local_test.go fixed spelling error in cli pull local test 2016-05-19 17:52:42 -05:00
docker_cli_pull_test.go Move implicit pull test to use local registry 2016-05-02 18:14:13 -07:00
docker_cli_pull_trusted_test.go Pull, Pull-A, and Build will only pull tags from the targets role or the targets/releases role. 2016-03-21 10:56:49 -07:00
docker_cli_push_test.go Remove deprecated Docker Content Trust ENV passphrase variables 2016-05-07 14:25:28 -07:00
docker_cli_registry_user_agent_test.go Pass upstream client's user agent through to registry on operations beyond pulls 2016-03-21 14:31:47 -07:00
docker_cli_rename_test.go Embedded DNS problem after renaming container. Step2:change in docker/daemon side and add integration test 2016-05-26 12:59:44 +08:00
docker_cli_restart_test.go Fix test case 2016-04-26 19:22:48 +08:00
docker_cli_rm_test.go
docker_cli_rmi_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_cli_run_test.go Merge pull request #22103 from coolljt0725/fix_22093 2016-05-30 15:57:13 +02:00
docker_cli_run_unix_test.go Add detach event 2016-06-03 11:59:11 +08:00
docker_cli_save_load_test.go Fix flaky TestSaveLoadParents 2016-04-06 21:58:47 -07:00
docker_cli_save_load_unix_test.go Fix docker load progressbar, fixes #21957 2016-04-12 22:45:42 -04:00
docker_cli_search_test.go Add --limit option to docker search 2016-06-02 19:12:20 -07:00
docker_cli_sni_test.go
docker_cli_start_test.go Better logging for errors in some tests 2016-03-25 10:02:52 -04:00
docker_cli_stats_test.go Do not remove containers from stats list on err 2016-04-13 16:36:34 -04:00
docker_cli_stop_test.go Add test case for stopping a restarting container 2016-04-10 15:39:28 +08:00
docker_cli_tag_test.go Remove deprecated -f flag on docker tag 2016-06-01 09:44:25 -07:00
docker_cli_top_test.go
docker_cli_update_test.go Fix flaky TestUpdateRestartPolicy on Windows 2016-03-14 12:49:24 +01:00
docker_cli_update_unix_test.go Add pause status check for --kernel-memory 2016-04-01 10:32:46 +08:00
docker_cli_userns_test.go Run privileged containers when userns are specified 2016-03-14 17:09:25 +02:00
docker_cli_v2_only_test.go Login update and endpoint refactor 2016-03-01 11:52:32 -08:00
docker_cli_version_test.go
docker_cli_volume_test.go Update usage and help to (almost) match the existing docker behaviour 2016-05-31 14:41:37 -07:00
docker_cli_wait_test.go Better logging for errors in some tests 2016-03-25 10:02:52 -04:00
docker_deprecated_api_v124_test.go remove deprecated feature of passing HostConfig at API container start 2016-06-01 22:25:17 +08:00
docker_deprecated_api_v124_unix_test.go remove deprecated feature of passing HostConfig at API container start 2016-06-01 22:25:17 +08:00
docker_experimental_network_test.go Add "--ipv6" flag in IT for network create when using ipv6 subnets 2016-03-24 16:19:59 -07:00
docker_hub_pull_suite_test.go fix typos 2016-06-02 17:17:22 +08:00
docker_test_vars.go Use dockerd instead of docker daemon in integration-cli 2016-05-26 13:14:35 +02:00
docker_utils.go Fix building image error if bridge network is disabled 2016-05-24 16:20:26 +08:00
events_utils.go Get events until a time in the past. 2016-04-14 16:22:16 -07:00
npipe.go Windows CI: Allow npipe protocol for sock requests 2016-03-02 14:22:51 -08:00
npipe_windows.go Windows CI: Allow npipe protocol for sock requests 2016-03-02 14:22:51 -08:00
registry.go distribution: errors: do not access the errors slice if it's empty 2016-03-16 09:00:39 +01:00
registry_mock.go
requirements.go Add non-experimental daemon as a test requirement. 2016-04-07 14:46:32 -07:00
requirements_unix.go pids limit support 2016-03-08 07:55:01 -08:00
test_vars_exec.go
test_vars_noexec.go
test_vars_noseccomp.go
test_vars_seccomp.go
test_vars_unix.go
test_vars_windows.go Fixing flaky tests on Windows (again) 2016-03-11 14:48:52 -08:00
trust_server.go Remove deprecated Docker Content Trust ENV passphrase variables 2016-05-07 14:25:28 -07:00
utils.go