From 67b83f518f423749d045824c3d8dfb636fb9666c Mon Sep 17 00:00:00 2001 From: Jean-Laurent de Morlhon Date: Wed, 25 Nov 2015 18:27:35 +0100 Subject: [PATCH] Fix #2410 Signed-off-by: Jean-Laurent de Morlhon Reviewed-by: David Gageot --- libmachine/drivers/serial.go | 6 ++++++ test/integration/core/inspect_format.bats | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/libmachine/drivers/serial.go b/libmachine/drivers/serial.go index 08d2f04e6a..056704eefd 100644 --- a/libmachine/drivers/serial.go +++ b/libmachine/drivers/serial.go @@ -3,6 +3,8 @@ package drivers import ( "sync" + "encoding/json" + "github.com/docker/machine/libmachine/mcnflag" "github.com/docker/machine/libmachine/state" ) @@ -164,3 +166,7 @@ func (d *SerialDriver) Stop() error { defer d.Unlock() return d.Driver.Stop() } + +func (d *SerialDriver) MarshalJSON() ([]byte, error) { + return json.Marshal(d.Driver) +} diff --git a/test/integration/core/inspect_format.bats b/test/integration/core/inspect_format.bats index 52710cf5a9..618610b25a 100644 --- a/test/integration/core/inspect_format.bats +++ b/test/integration/core/inspect_format.bats @@ -21,3 +21,9 @@ load ${BASE_TEST_DIR}/helpers.bash linecount=$(machine inspect -f '{{prettyjson .Driver}}' $NAME | wc -l) [[ "$linecount" -gt 1 ]] } + +@test "$DRIVER: check .Driver output is not flawed" { + run docker-machine inspect -f '{{.Driver.SSHUser}}' $NAME + [ "$status" -eq 0 ] + [[ ${output} == "docker" ]] +} \ No newline at end of file