mirror of
https://github.com/docker/compose.git
synced 2026-08-31 23:03:55 +00:00
Merge pull request #724 from gtardif/json_context_format
Allow `docker context ls —formatter {{json.}}` to not delegate to Moby and include context type in the json
This commit is contained in:
commit
6fa93db021
4 changed files with 19 additions and 3 deletions
|
|
@ -81,6 +81,12 @@ func TestContextDefault(t *testing.T) {
|
|||
|
||||
res = c.RunDockerCmd("context", "ls", "--format", "json")
|
||||
golden.Assert(t, res.Stdout(), GoldenFile("ls-out-json"))
|
||||
|
||||
res = c.RunDockerCmd("context", "ls", "--json")
|
||||
golden.Assert(t, res.Stdout(), GoldenFile("ls-out-json"))
|
||||
|
||||
res = c.RunDockerCmd("context", "ls", "--format", "{{ json . }}")
|
||||
golden.Assert(t, res.Stdout(), GoldenFile("ls-out-json"))
|
||||
})
|
||||
|
||||
t.Run("inspect", func(t *testing.T) {
|
||||
|
|
@ -422,6 +428,13 @@ func TestVersion(t *testing.T) {
|
|||
res.Assert(t, icmd.Expected{Out: `"Client":`})
|
||||
})
|
||||
|
||||
t.Run("format legacy", func(t *testing.T) {
|
||||
res := c.RunDockerCmd("version", "-f", "{{ json .Client }}")
|
||||
res.Assert(t, icmd.Expected{Out: `"DefaultAPIVersion":`})
|
||||
res = c.RunDockerCmd("version", "--format", "{{ json .Server }}")
|
||||
res.Assert(t, icmd.Expected{Out: `"KernelVersion":`})
|
||||
})
|
||||
|
||||
t.Run("format cloud integration", func(t *testing.T) {
|
||||
res := c.RunDockerCmd("version", "-f", "pretty")
|
||||
res.Assert(t, icmd.Expected{Out: `Cloud integration:`})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue