github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/integration-cli/docker_api_info_test.go (about)

     1  package main
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/docker/docker/pkg/integration/checker"
     7  	"github.com/go-check/check"
     8  )
     9  
    10  func (s *DockerSuite) TestInfoAPI(c *check.C) {
    11  	endpoint := "/info"
    12  
    13  	status, body, err := sockRequest("GET", endpoint, nil)
    14  	c.Assert(status, checker.Equals, http.StatusOK)
    15  	c.Assert(err, checker.IsNil)
    16  
    17  	// always shown fields
    18  	stringsToCheck := []string{
    19  		"ID",
    20  		"Containers",
    21  		"ContainersRunning",
    22  		"ContainersPaused",
    23  		"ContainersStopped",
    24  		"Images",
    25  		"LoggingDriver",
    26  		"OperatingSystem",
    27  		"NCPU",
    28  		"OSType",
    29  		"Architecture",
    30  		"MemTotal",
    31  		"KernelVersion",
    32  		"Driver",
    33  		"ServerVersion",
    34  		"SecurityOptions"}
    35  
    36  	out := string(body)
    37  	for _, linePrefix := range stringsToCheck {
    38  		c.Assert(out, checker.Contains, linePrefix)
    39  	}
    40  }
    41  
    42  func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
    43  	endpoint := "/v1.20/info"
    44  
    45  	status, body, err := sockRequest("GET", endpoint, nil)
    46  	c.Assert(status, checker.Equals, http.StatusOK)
    47  	c.Assert(err, checker.IsNil)
    48  
    49  	out := string(body)
    50  	c.Assert(out, checker.Contains, "ExecutionDriver")
    51  	c.Assert(out, checker.Contains, "not supported")
    52  }