From 68d9beedbe0994af5c91022874daa271b657be8c Mon Sep 17 00:00:00 2001
From: Yong Tang <yong.tang.github@outlook.com>
Date: Wed, 7 Feb 2018 18:23:31 +0000
Subject: [PATCH] Migrates docker info tests to integration api tests

This fix migrates docker info tests in integration-cli
to integration tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
---
 integration-cli/docker_api_info_test.go | 61 -------------------------
 integration/system/info_linux_test.go   | 19 +++++++-
 integration/system/info_test.go         | 42 +++++++++++++++++
 3 files changed, 60 insertions(+), 62 deletions(-)
 delete mode 100644 integration-cli/docker_api_info_test.go
 create mode 100644 integration/system/info_test.go

diff --git a/integration-cli/docker_api_info_test.go b/integration-cli/docker_api_info_test.go
deleted file mode 100644
index e7d77f0985..0000000000
--- a/integration-cli/docker_api_info_test.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package main
-
-import (
-	"net/http"
-
-	"fmt"
-
-	"github.com/docker/docker/client"
-	"github.com/docker/docker/integration-cli/checker"
-	"github.com/docker/docker/integration-cli/request"
-	"github.com/go-check/check"
-	"golang.org/x/net/context"
-)
-
-func (s *DockerSuite) TestInfoAPI(c *check.C) {
-	cli, err := client.NewEnvClient()
-	c.Assert(err, checker.IsNil)
-	defer cli.Close()
-
-	info, err := cli.Info(context.Background())
-	c.Assert(err, checker.IsNil)
-
-	// always shown fields
-	stringsToCheck := []string{
-		"ID",
-		"Containers",
-		"ContainersRunning",
-		"ContainersPaused",
-		"ContainersStopped",
-		"Images",
-		"LoggingDriver",
-		"OperatingSystem",
-		"NCPU",
-		"OSType",
-		"Architecture",
-		"MemTotal",
-		"KernelVersion",
-		"Driver",
-		"ServerVersion",
-		"SecurityOptions"}
-
-	out := fmt.Sprintf("%+v", info)
-	for _, linePrefix := range stringsToCheck {
-		c.Assert(out, checker.Contains, linePrefix)
-	}
-}
-
-func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
-	testRequires(c, DaemonIsLinux) // Windows only supports 1.25 or later
-
-	res, body, err := request.Get("/v1.20/info")
-	c.Assert(res.StatusCode, checker.Equals, http.StatusOK)
-	c.Assert(err, checker.IsNil)
-
-	b, err := request.ReadBody(body)
-	c.Assert(err, checker.IsNil)
-
-	out := string(b)
-	c.Assert(out, checker.Contains, "ExecutionDriver")
-	c.Assert(out, checker.Contains, "not supported")
-}
diff --git a/integration/system/info_linux_test.go b/integration/system/info_linux_test.go
index bea14eaddd..28629d2f8e 100644
--- a/integration/system/info_linux_test.go
+++ b/integration/system/info_linux_test.go
@@ -3,15 +3,17 @@
 package system
 
 import (
+	"net/http"
 	"testing"
 
+	req "github.com/docker/docker/integration-cli/request"
 	"github.com/docker/docker/integration/util/request"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 	"golang.org/x/net/context"
 )
 
-func TestInfo_BinaryCommits(t *testing.T) {
+func TestInfoBinaryCommits(t *testing.T) {
 	client := request.NewAPIClient(t)
 
 	info, err := client.Info(context.Background())
@@ -32,3 +34,18 @@ func TestInfo_BinaryCommits(t *testing.T) {
 	assert.Equal(t, testEnv.DaemonInfo.RuncCommit.Expected, info.RuncCommit.Expected)
 	assert.Equal(t, info.RuncCommit.Expected, info.RuncCommit.ID)
 }
+
+func TestInfoAPIVersioned(t *testing.T) {
+	// Windows only supports 1.25 or later
+
+	res, body, err := req.Get("/v1.20/info")
+	require.NoError(t, err)
+	assert.Equal(t, res.StatusCode, http.StatusOK)
+
+	b, err := req.ReadBody(body)
+	require.NoError(t, err)
+
+	out := string(b)
+	assert.Contains(t, out, "ExecutionDriver")
+	assert.Contains(t, out, "not supported")
+}
diff --git a/integration/system/info_test.go b/integration/system/info_test.go
new file mode 100644
index 0000000000..4b90b5c61c
--- /dev/null
+++ b/integration/system/info_test.go
@@ -0,0 +1,42 @@
+package system
+
+import (
+	"fmt"
+	"testing"
+
+	"github.com/docker/docker/integration/util/request"
+	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
+	"golang.org/x/net/context"
+)
+
+func TestInfoAPI(t *testing.T) {
+	client := request.NewAPIClient(t)
+
+	info, err := client.Info(context.Background())
+	require.NoError(t, err)
+
+	// always shown fields
+	stringsToCheck := []string{
+		"ID",
+		"Containers",
+		"ContainersRunning",
+		"ContainersPaused",
+		"ContainersStopped",
+		"Images",
+		"LoggingDriver",
+		"OperatingSystem",
+		"NCPU",
+		"OSType",
+		"Architecture",
+		"MemTotal",
+		"KernelVersion",
+		"Driver",
+		"ServerVersion",
+		"SecurityOptions"}
+
+	out := fmt.Sprintf("%+v", info)
+	for _, linePrefix := range stringsToCheck {
+		assert.Contains(t, out, linePrefix)
+	}
+}