2015-04-10 13:26:30 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
2015-04-22 14:44:54 -04:00
|
|
|
|
2015-11-18 20:15:38 -05:00
|
|
|
"github.com/docker/docker/pkg/integration/checker"
|
2015-04-22 14:44:54 -04:00
|
|
|
"github.com/go-check/check"
|
2015-04-10 13:26:30 -04:00
|
|
|
)
|
|
|
|
|
2015-04-22 14:44:54 -04:00
|
|
|
func (s *DockerSuite) TestInfoApi(c *check.C) {
|
2015-04-10 13:26:30 -04:00
|
|
|
endpoint := "/info"
|
|
|
|
|
2015-04-20 17:03:56 -04:00
|
|
|
status, body, err := sockRequest("GET", endpoint, nil)
|
2015-11-18 20:15:38 -05:00
|
|
|
c.Assert(status, checker.Equals, http.StatusOK)
|
|
|
|
c.Assert(err, checker.IsNil)
|
2015-04-10 13:26:30 -04:00
|
|
|
|
|
|
|
// always shown fields
|
|
|
|
stringsToCheck := []string{
|
|
|
|
"ID",
|
|
|
|
"Containers",
|
2015-10-27 16:12:33 -04:00
|
|
|
"ContainersRunning",
|
|
|
|
"ContainersPaused",
|
|
|
|
"ContainersStopped",
|
2015-04-10 13:26:30 -04:00
|
|
|
"Images",
|
|
|
|
"ExecutionDriver",
|
|
|
|
"LoggingDriver",
|
|
|
|
"OperatingSystem",
|
|
|
|
"NCPU",
|
2015-06-13 03:39:19 -04:00
|
|
|
"OSType",
|
|
|
|
"Architecture",
|
2015-04-10 13:26:30 -04:00
|
|
|
"MemTotal",
|
|
|
|
"KernelVersion",
|
2015-09-21 00:23:54 -04:00
|
|
|
"Driver",
|
|
|
|
"ServerVersion"}
|
2015-04-10 13:26:30 -04:00
|
|
|
|
|
|
|
out := string(body)
|
|
|
|
for _, linePrefix := range stringsToCheck {
|
2015-11-18 20:15:38 -05:00
|
|
|
c.Assert(out, checker.Contains, linePrefix)
|
2015-04-10 13:26:30 -04:00
|
|
|
}
|
|
|
|
}
|