From 55268f4e9158738631f04e7e4becf39c9043b60a Mon Sep 17 00:00:00 2001 From: John Howard Date: Tue, 2 Feb 2016 17:59:11 -0800 Subject: [PATCH] Windows: Turn off stats Signed-off-by: John Howard --- daemon/stats.go | 6 ++++++ integration-cli/docker_cli_stats_test.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/daemon/stats.go b/daemon/stats.go index 9812dce575..a3155165e9 100644 --- a/daemon/stats.go +++ b/daemon/stats.go @@ -2,7 +2,9 @@ package daemon import ( "encoding/json" + "errors" "io" + "runtime" "github.com/docker/docker/daemon/execdriver" "github.com/docker/docker/pkg/version" @@ -22,6 +24,10 @@ type ContainerStatsConfig struct { // ContainerStats writes information about the container to the stream // given in the config object. func (daemon *Daemon) ContainerStats(prefixOrName string, config *ContainerStatsConfig) error { + if runtime.GOOS == "windows" { + return errors.New("Windows does not support stats") + } + container, err := daemon.GetContainer(prefixOrName) if err != nil { return err diff --git a/integration-cli/docker_cli_stats_test.go b/integration-cli/docker_cli_stats_test.go index 1258c66576..cabc03e9be 100644 --- a/integration-cli/docker_cli_stats_test.go +++ b/integration-cli/docker_cli_stats_test.go @@ -12,6 +12,7 @@ import ( ) func (s *DockerSuite) TestStatsNoStream(c *check.C) { + // Windows does not support stats testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") id := strings.TrimSpace(out) @@ -40,6 +41,7 @@ func (s *DockerSuite) TestStatsNoStream(c *check.C) { } func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) { + // Windows does not support stats testRequires(c, DaemonIsLinux) out, _, err := dockerCmdWithError("stats", "notfound") @@ -52,6 +54,7 @@ func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) { } func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) { + // Windows does not support stats testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -75,6 +78,7 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) { } func (s *DockerSuite) TestStatsAllNoStream(c *check.C) { + // Windows does not support stats testRequires(c, DaemonIsLinux) out, _ := dockerCmd(c, "run", "-d", "busybox", "top") @@ -92,6 +96,7 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) { } func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) { + // Windows does not support stats testRequires(c, DaemonIsLinux) id := make(chan string)