Browse code

Windows: Turn off stats

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/02/03 10:59:11
Showing 2 changed files
... ...
@@ -2,7 +2,9 @@ package daemon
2 2
 
3 3
 import (
4 4
 	"encoding/json"
5
+	"errors"
5 6
 	"io"
7
+	"runtime"
6 8
 
7 9
 	"github.com/docker/docker/daemon/execdriver"
8 10
 	"github.com/docker/docker/pkg/version"
... ...
@@ -22,6 +24,10 @@ type ContainerStatsConfig struct {
22 22
 // ContainerStats writes information about the container to the stream
23 23
 // given in the config object.
24 24
 func (daemon *Daemon) ContainerStats(prefixOrName string, config *ContainerStatsConfig) error {
25
+	if runtime.GOOS == "windows" {
26
+		return errors.New("Windows does not support stats")
27
+	}
28
+
25 29
 	container, err := daemon.GetContainer(prefixOrName)
26 30
 	if err != nil {
27 31
 		return err
... ...
@@ -12,6 +12,7 @@ import (
12 12
 )
13 13
 
14 14
 func (s *DockerSuite) TestStatsNoStream(c *check.C) {
15
+	// Windows does not support stats
15 16
 	testRequires(c, DaemonIsLinux)
16 17
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
17 18
 	id := strings.TrimSpace(out)
... ...
@@ -40,6 +41,7 @@ func (s *DockerSuite) TestStatsNoStream(c *check.C) {
40 40
 }
41 41
 
42 42
 func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) {
43
+	// Windows does not support stats
43 44
 	testRequires(c, DaemonIsLinux)
44 45
 
45 46
 	out, _, err := dockerCmdWithError("stats", "notfound")
... ...
@@ -52,6 +54,7 @@ func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) {
52 52
 }
53 53
 
54 54
 func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
55
+	// Windows does not support stats
55 56
 	testRequires(c, DaemonIsLinux)
56 57
 
57 58
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
... ...
@@ -75,6 +78,7 @@ func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
75 75
 }
76 76
 
77 77
 func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
78
+	// Windows does not support stats
78 79
 	testRequires(c, DaemonIsLinux)
79 80
 
80 81
 	out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
... ...
@@ -92,6 +96,7 @@ func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
92 92
 }
93 93
 
94 94
 func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
95
+	// Windows does not support stats
95 96
 	testRequires(c, DaemonIsLinux)
96 97
 
97 98
 	id := make(chan string)