mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
63b5a37203
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
52 lines
1.1 KiB
Go
52 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
|
"github.com/go-check/check"
|
|
)
|
|
|
|
func (s *DockerSuite) TestInfoAPI(c *check.C) {
|
|
endpoint := "/info"
|
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
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 := string(body)
|
|
for _, linePrefix := range stringsToCheck {
|
|
c.Assert(out, checker.Contains, linePrefix)
|
|
}
|
|
}
|
|
|
|
func (s *DockerSuite) TestInfoAPIVersioned(c *check.C) {
|
|
endpoint := "/v1.20/info"
|
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
out := string(body)
|
|
c.Assert(out, checker.Contains, "ExecutionDriver")
|
|
c.Assert(out, checker.Contains, "not supported")
|
|
}
|